var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

!function (e, n) {
  "function" == typeof define && (define.amd || define.cmd) ? define(function () {
    return n(e);
  }) : n(e, !0);
}(this, function (e, n) {
  function i(n, i, t) {
    e.WeixinJSBridge ? WeixinJSBridge.invoke(n, o(i), function (e) {
      c(n, e, t);
    }) : l(n, t);
  }function t(n, i, t) {
    e.WeixinJSBridge ? WeixinJSBridge.on(n, function (e) {
      t && t.trigger && t.trigger(e), c(n, e, i);
    }) : t ? l(n, t) : l(n, i);
  }function o(e) {
    return e = e || {}, e.appId = A.appId, e.verifyAppId = A.appId, e.verifySignType = "sha1", e.verifyTimestamp = A.timestamp + "", e.verifyNonceStr = A.nonceStr, e.verifySignature = A.signature, e;
  }function r(e) {
    return { timeStamp: e.timestamp + "", nonceStr: e.nonceStr, package: e.package, paySign: e.paySign, signType: e.signType || "SHA1" };
  }function a(e) {
    return e.postalCode = e.addressPostalCode, delete e.addressPostalCode, e.provinceName = e.proviceFirstStageName, delete e.proviceFirstStageName, e.cityName = e.addressCitySecondStageName, delete e.addressCitySecondStageName, e.countryName = e.addressCountiesThirdStageName, delete e.addressCountiesThirdStageName, e.detailInfo = e.addressDetailInfo, delete e.addressDetailInfo, e;
  }function c(e, n, i) {
    "openEnterpriseChat" == e && (n.errCode = n.err_code), delete n.err_code, delete n.err_desc, delete n.err_detail;var t = n.errMsg;t || (t = n.err_msg, delete n.err_msg, t = s(e, t), n.errMsg = t), (i = i || {})._complete && (i._complete(n), delete i._complete), t = n.errMsg || "", A.debug && !i.isInnerInvoke && alert(JSON.stringify(n));var o = t.indexOf(":");switch (t.substring(o + 1)) {case "ok":
        i.success && i.success(n);break;case "cancel":
        i.cancel && i.cancel(n);break;default:
        i.fail && i.fail(n);}i.complete && i.complete(n);
  }function s(e, n) {
    var i = e,
        t = h[i];t && (i = t);var o = "ok";if (n) {
      var r = n.indexOf(":");"confirm" == (o = n.substring(r + 1)) && (o = "ok"), "failed" == o && (o = "fail"), -1 != o.indexOf("failed_") && (o = o.substring(7)), -1 != o.indexOf("fail_") && (o = o.substring(5)), "access denied" != (o = (o = o.replace(/_/g, " ")).toLowerCase()) && "no permission to execute" != o || (o = "permission denied"), "config" == i && "function not exist" == o && (o = "ok"), "" == o && (o = "fail");
    }return n = i + ":" + o;
  }function d(e) {
    if (e) {
      for (var n = 0, i = e.length; n < i; ++n) {
        var t = e[n],
            o = g[t];o && (e[n] = o);
      }return e;
    }
  }function l(e, n) {
    if (!(!A.debug || n && n.isInnerInvoke)) {
      var i = h[e];i && (e = i), n && n._complete && delete n._complete, console.log('"' + e + '",', n || "");
    }
  }function u(e) {
    if (!(_ || w || A.debug || M < "6.0.2" || V.systemType < 0)) {
      var n = new Image();V.appId = A.appId, V.initTime = C.initEndTime - C.initStartTime, V.preVerifyTime = C.preVerifyEndTime - C.preVerifyStartTime, N.getNetworkType({ isInnerInvoke: !0, success: function success(e) {
          V.networkType = e.networkType;var i = "https://open.weixin.qq.com/sdk/report?v=" + V.version + "&o=" + V.isPreVerifyOk + "&s=" + V.systemType + "&c=" + V.clientVersion + "&a=" + V.appId + "&n=" + V.networkType + "&i=" + V.initTime + "&p=" + V.preVerifyTime + "&u=" + V.url;n.src = i;
        } });
    }
  }function p() {
    return new Date().getTime();
  }function f(n) {
    T && (e.WeixinJSBridge ? n() : S.addEventListener && S.addEventListener("WeixinJSBridgeReady", n, !1));
  }function m() {
    N.invoke || (N.invoke = function (n, i, t) {
      e.WeixinJSBridge && WeixinJSBridge.invoke(n, o(i), t);
    }, N.on = function (n, i) {
      e.WeixinJSBridge && WeixinJSBridge.on(n, i);
    });
  }if (!e.jWeixin) {
    var _N;

    var g = { config: "preVerifyJSAPI", onMenuShareTimeline: "menu:share:timeline", onMenuShareAppMessage: "menu:share:appmessage", onMenuShareQQ: "menu:share:qq", onMenuShareWeibo: "menu:share:weiboApp", onMenuShareQZone: "menu:share:QZone", previewImage: "imagePreview", getLocation: "geoLocation", openProductSpecificView: "openProductViewWithPid", addCard: "batchAddCard", openCard: "batchViewCard", chooseWXPay: "getBrandWCPayRequest", openEnterpriseRedPacket: "getRecevieBizHongBaoRequest", startSearchBeacons: "startMonitoringBeacons", stopSearchBeacons: "stopMonitoringBeacons", onSearchBeacons: "onBeaconsInRange", consumeAndShareCard: "consumedShareCard", openAddress: "editAddress" },
        h = function () {
      var e = {};for (var n in g) {
        e[g[n]] = n;
      }return e;
    }(),
        S = e.document,
        v = S.title,
        y = navigator.userAgent.toLowerCase(),
        I = navigator.platform.toLowerCase(),
        _ = !(!I.match("mac") && !I.match("win")),
        w = -1 != y.indexOf("wxdebugger"),
        T = -1 != y.indexOf("micromessenger"),
        k = -1 != y.indexOf("android"),
        x = -1 != y.indexOf("iphone") || -1 != y.indexOf("ipad"),
        M = function () {
      var e = y.match(/micromessenger\/(\d+\.\d+\.\d+)/) || y.match(/micromessenger\/(\d+\.\d+)/);return e ? e[1] : "";
    }(),
        C = { initStartTime: p(), initEndTime: 0, preVerifyStartTime: 0, preVerifyEndTime: 0 },
        V = { version: 1, appId: "", initTime: 0, preVerifyTime: 0, networkType: "", isPreVerifyOk: 1, systemType: x ? 1 : k ? 2 : -1, clientVersion: M, url: encodeURIComponent(location.href) },
        A = {},
        P = { _completes: [] },
        L = { state: 0, data: {} };f(function () {
      C.initEndTime = p();
    });var B = !1,
        O = [],
        N = (_N = { config: function config(e) {
        A = e, l("config", e);var n = !1 !== A.check;f(function () {
          if (n) i(g.config, { verifyJsApiList: d(A.jsApiList) }, function () {
            P._complete = function (e) {
              C.preVerifyEndTime = p(), L.state = 1, L.data = e;
            }, P.success = function (e) {
              V.isPreVerifyOk = 0;
            }, P.fail = function (e) {
              P._fail ? P._fail(e) : L.state = -1;
            };var e = P._completes;return e.push(function () {
              u();
            }), P.complete = function (n) {
              for (var i = 0, t = e.length; i < t; ++i) {
                e[i]();
              }P._completes = [];
            }, P;
          }()), C.preVerifyStartTime = p();else {
            L.state = 1;for (var e = P._completes, t = 0, o = e.length; t < o; ++t) {
              e[t]();
            }P._completes = [];
          }
        }), A.beta && m();
      }, ready: function ready(e) {
        0 != L.state ? e() : (P._completes.push(e), !T && A.debug && e());
      }, error: function error(e) {
        M < "6.0.2" || (-1 == L.state ? e(L.data) : P._fail = e);
      }, checkJsApi: function checkJsApi(e) {
        var n = function n(e) {
          var n = e.checkResult;for (var i in n) {
            var t = h[i];t && (n[t] = n[i], delete n[i]);
          }return e;
        };i("checkJsApi", { jsApiList: d(e.jsApiList) }, (e._complete = function (e) {
          if (k) {
            var i = e.checkResult;i && (e.checkResult = JSON.parse(i));
          }e = n(e);
        }, e));
      }, onMenuShareTimeline: function onMenuShareTimeline(e) {
        t(g.onMenuShareTimeline, { complete: function complete() {
            i("shareTimeline", { title: e.title || v, desc: e.title || v, img_url: e.imgUrl || "", link: e.link || location.href, type: e.type || "link", data_url: e.dataUrl || "" }, e);
          } }, e);
      }, onMenuShareAppMessage: function onMenuShareAppMessage(e) {
        t(g.onMenuShareAppMessage, { complete: function complete(n) {
            "favorite" === n.scene ? i("sendAppMessage", { title: e.title || v, desc: e.desc || "", link: e.link || location.href, img_url: e.imgUrl || "", type: e.type || "link", data_url: e.dataUrl || "" }) : i("sendAppMessage", { title: e.title || v, desc: e.desc || "", link: e.link || location.href, img_url: e.imgUrl || "", type: e.type || "link", data_url: e.dataUrl || "" }, e);
          } }, e);
      }, onMenuShareQQ: function onMenuShareQQ(e) {
        t(g.onMenuShareQQ, { complete: function complete() {
            i("shareQQ", { title: e.title || v, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e);
          } }, e);
      }, onMenuShareWeibo: function onMenuShareWeibo(e) {
        t(g.onMenuShareWeibo, { complete: function complete() {
            i("shareWeiboApp", { title: e.title || v, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e);
          } }, e);
      }, onMenuShareQZone: function onMenuShareQZone(e) {
        t(g.onMenuShareQZone, { complete: function complete() {
            i("shareQZone", { title: e.title || v, desc: e.desc || "", img_url: e.imgUrl || "", link: e.link || location.href }, e);
          } }, e);
      }, startRecord: function startRecord(e) {
        i("startRecord", {}, e);
      }, stopRecord: function stopRecord(e) {
        i("stopRecord", {}, e);
      }, onVoiceRecordEnd: function onVoiceRecordEnd(e) {
        t("onVoiceRecordEnd", e);
      }, playVoice: function playVoice(e) {
        i("playVoice", { localId: e.localId }, e);
      }, pauseVoice: function pauseVoice(e) {
        i("pauseVoice", { localId: e.localId }, e);
      }, stopVoice: function stopVoice(e) {
        i("stopVoice", { localId: e.localId }, e);
      }, onVoicePlayEnd: function onVoicePlayEnd(e) {
        t("onVoicePlayEnd", e);
      }, uploadVoice: function uploadVoice(e) {
        i("uploadVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e);
      }, downloadVoice: function downloadVoice(e) {
        i("downloadVoice", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e);
      }, translateVoice: function translateVoice(e) {
        i("translateVoice", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e);
      }, chooseImage: function chooseImage(e) {
        i("chooseImage", { scene: "1|2", count: e.count || 9, sizeType: e.sizeType || ["original", "compressed"], sourceType: e.sourceType || ["album", "camera"] }, (e._complete = function (e) {
          if (k) {
            var n = e.localIds;n && (e.localIds = JSON.parse(n));
          }
        }, e));
      }, getLocation: function getLocation(e) {}, previewImage: function previewImage(e) {
        i(g.previewImage, { current: e.current, urls: e.urls }, e);
      }, uploadImage: function uploadImage(e) {
        i("uploadImage", { localId: e.localId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e);
      }, downloadImage: function downloadImage(e) {
        i("downloadImage", { serverId: e.serverId, isShowProgressTips: 0 == e.isShowProgressTips ? 0 : 1 }, e);
      }, getLocalImgData: function getLocalImgData(e) {
        !1 === B ? (B = !0, i("getLocalImgData", { localId: e.localId }, (e._complete = function (e) {
          if (B = !1, O.length > 0) {
            var n = O.shift();wx.getLocalImgData(n);
          }
        }, e))) : O.push(e);
      }, getNetworkType: function getNetworkType(e) {
        var n = function n(e) {
          var n = e.errMsg;e.errMsg = "getNetworkType:ok";var i = e.subtype;if (delete e.subtype, i) e.networkType = i;else {
            var t = n.indexOf(":"),
                o = n.substring(t + 1);switch (o) {case "wifi":case "edge":case "wwan":
                e.networkType = o;break;default:
                e.errMsg = "getNetworkType:fail";}
          }return e;
        };i("getNetworkType", {}, (e._complete = function (e) {
          e = n(e);
        }, e));
      }, openLocation: function openLocation(e) {
        i("openLocation", { latitude: e.latitude, longitude: e.longitude, name: e.name || "", address: e.address || "", scale: e.scale || 28, infoUrl: e.infoUrl || "" }, e);
      } }, _defineProperty(_N, "getLocation", function getLocation(e) {
      e = e || {}, i(g.getLocation, { type: e.type || "wgs84" }, (e._complete = function (e) {
        delete e.type;
      }, e));
    }), _defineProperty(_N, "hideOptionMenu", function hideOptionMenu(e) {
      i("hideOptionMenu", {}, e);
    }), _defineProperty(_N, "showOptionMenu", function showOptionMenu(e) {
      i("showOptionMenu", {}, e);
    }), _defineProperty(_N, "closeWindow", function closeWindow(e) {
      i("closeWindow", {}, e = e || {});
    }), _defineProperty(_N, "hideMenuItems", function hideMenuItems(e) {
      i("hideMenuItems", { menuList: e.menuList }, e);
    }), _defineProperty(_N, "showMenuItems", function showMenuItems(e) {
      i("showMenuItems", { menuList: e.menuList }, e);
    }), _defineProperty(_N, "hideAllNonBaseMenuItem", function hideAllNonBaseMenuItem(e) {
      i("hideAllNonBaseMenuItem", {}, e);
    }), _defineProperty(_N, "showAllNonBaseMenuItem", function showAllNonBaseMenuItem(e) {
      i("showAllNonBaseMenuItem", {}, e);
    }), _defineProperty(_N, "scanQRCode", function scanQRCode(e) {
      i("scanQRCode", { needResult: (e = e || {}).needResult || 0, scanType: e.scanType || ["qrCode", "barCode"] }, (e._complete = function (e) {
        if (x) {
          var n = e.resultStr;if (n) {
            var i = JSON.parse(n);e.resultStr = i && i.scan_code && i.scan_code.scan_result;
          }
        }
      }, e));
    }), _defineProperty(_N, "openAddress", function openAddress(e) {
      i(g.openAddress, {}, (e._complete = function (e) {
        e = a(e);
      }, e));
    }), _defineProperty(_N, "openProductSpecificView", function openProductSpecificView(e) {
      i(g.openProductSpecificView, { pid: e.productId, view_type: e.viewType || 0, ext_info: e.extInfo }, e);
    }), _defineProperty(_N, "addCard", function addCard(e) {
      for (var n = e.cardList, t = [], o = 0, r = n.length; o < r; ++o) {
        var a = n[o],
            c = { card_id: a.cardId, card_ext: a.cardExt };t.push(c);
      }i(g.addCard, { card_list: t }, (e._complete = function (e) {
        var n = e.card_list;if (n) {
          for (var i = 0, t = (n = JSON.parse(n)).length; i < t; ++i) {
            var o = n[i];o.cardId = o.card_id, o.cardExt = o.card_ext, o.isSuccess = !!o.is_succ, delete o.card_id, delete o.card_ext, delete o.is_succ;
          }e.cardList = n, delete e.card_list;
        }
      }, e));
    }), _defineProperty(_N, "chooseCard", function chooseCard(e) {
      i("chooseCard", { app_id: A.appId, location_id: e.shopId || "", sign_type: e.signType || "SHA1", card_id: e.cardId || "", card_type: e.cardType || "", card_sign: e.cardSign, time_stamp: e.timestamp + "", nonce_str: e.nonceStr }, (e._complete = function (e) {
        e.cardList = e.choose_card_info, delete e.choose_card_info;
      }, e));
    }), _defineProperty(_N, "openCard", function openCard(e) {
      for (var n = e.cardList, t = [], o = 0, r = n.length; o < r; ++o) {
        var a = n[o],
            c = { card_id: a.cardId, code: a.code };t.push(c);
      }i(g.openCard, { card_list: t }, e);
    }), _defineProperty(_N, "consumeAndShareCard", function consumeAndShareCard(e) {
      i(g.consumeAndShareCard, { consumedCardId: e.cardId, consumedCode: e.code }, e);
    }), _defineProperty(_N, "chooseWXPay", function chooseWXPay(e) {
      i(g.chooseWXPay, r(e), e);
    }), _defineProperty(_N, "openEnterpriseRedPacket", function openEnterpriseRedPacket(e) {
      i(g.openEnterpriseRedPacket, r(e), e);
    }), _defineProperty(_N, "startSearchBeacons", function startSearchBeacons(e) {
      i(g.startSearchBeacons, { ticket: e.ticket }, e);
    }), _defineProperty(_N, "stopSearchBeacons", function stopSearchBeacons(e) {
      i(g.stopSearchBeacons, {}, e);
    }), _defineProperty(_N, "onSearchBeacons", function onSearchBeacons(e) {
      t(g.onSearchBeacons, e);
    }), _defineProperty(_N, "openEnterpriseChat", function openEnterpriseChat(e) {
      i("openEnterpriseChat", { useridlist: e.userIds, chatname: e.groupName }, e);
    }), _N),
        E = 1,
        b = {};return S.addEventListener("error", function (e) {
      if (!k) {
        var n = e.target,
            i = n.tagName,
            t = n.src;if (("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) && -1 != t.indexOf("wxlocalresource://")) {
          e.preventDefault(), e.stopPropagation();var o = n["wx-id"];if (o || (o = E++, n["wx-id"] = o), b[o]) return;b[o] = !0, wx.ready(function () {
            wx.getLocalImgData({ localId: t, success: function success(e) {
                n.src = e.localData;
              } });
          });
        }
      }
    }, !0), S.addEventListener("load", function (e) {
      if (!k) {
        var n = e.target,
            i = n.tagName;n.src;if ("IMG" == i || "VIDEO" == i || "AUDIO" == i || "SOURCE" == i) {
          var t = n["wx-id"];t && (b[t] = !1);
        }
      }
    }, !0), n && (e.wx = e.jWeixin = N), N;
  }
});
var config = {
  APPID: 'wx27900e3078720b6f',
  socialType: 'wx-jqfx',
  apiUrl: 'https://gate.97kid.com',
  staticUrl: 'https://gstatic.97kid.com',
  requestTimeout: 20000,
  appId: 'antYy9lOFi5mkU9QKjtYmRLM-gzGzoHsz',
  appKey: 'jqyWxLyobpsmdwsJddJlDheb'
};

function checkWxExist() {
  return (typeof wx === "undefined" ? "undefined" : _typeof(wx)) === 'object';
}

function WxConfig(options, campaign, random) {
  checkWxExist() && wx.config({
    debug: false,
    appId: config.APPID,
    timestamp: options.timestamp,
    nonceStr: options.nonceStr,
    signature: options.signature,
    jsApiList: options.jsApiList
  });

  checkWxExist() && wx.error(function (res) {
    console.log('微信验证失败 ' + JSON.stringify(res));
  });

  var shareMsg = {
    title: options.title || '【Qkids久趣】4-12岁，在家跟北美外教学英语，新用户100元体验！',
    desc: options.desc || '严选北美外教在线授课，创造趣味十足的课堂体验，让孩子爱学更有效。',
    link: options.link || window.location.protocol + '//' + window.location.host + '/wx',
    imgUrl: options.imgUrl || 'https://static-app.97kid.com/site-student/public/img/share.png',

    success: function success() {},
    fail: function fail(res) {
      // $.toastAlert('微信分享朋友圈失败: ' + JSON.stringify(res));
    }
  };

  switch (campaign) {
    case 'doubleeleven':
      shareMsg.title = '【双11】久趣148元/8课时！在家跟北美外教学英语。';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/doubleeleven' + Math.ceil(Math.random() * 100);
      break;
    case 'christmas':
      shareMsg.title = '【久趣英语圣诞主题课】9.9元和北美外教过圣诞！';
      shareMsg.desc = '4-12岁在线上课，4人成团。快来唱圣诞歌，体验地道圣诞文化！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/christmas' + Math.ceil(Math.random() * 100);
      break;
    case 'winterclass':
      shareMsg.title = '【久趣148元/10课时】寒假在家跟北美外教学英语';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/winterclass' + Math.ceil(Math.random() * 100);
      break;
    case 'award':
      shareMsg.title = '【久趣特惠团购】给4-12岁儿童的北美外教超值英语课！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/award' + Math.ceil(Math.random() * 100);
      break;
    case 'easter':
      shareMsg.title = '【久趣英语复活节主题课】19.9元，北美外教带你画彩蛋！';
      shareMsg.desc = '4-12岁，四人成团，在线上课。快来体验复活节文化，get纯正美语！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/easter' + Math.ceil(Math.random() * 100);
      break;
    case 'easter1':
      shareMsg.title = '【久趣英语复活节主题课】29.9元，北美外教带你画彩蛋！';
      shareMsg.desc = '4-12岁，四人成团，在线上课。快来体验复活节文化，get纯正美语！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/easter1' + Math.ceil(Math.random() * 100);
      break;
    case 'phonics':
      shareMsg.title = '限时！久趣自然拼读，9元解锁2节课！';
      shareMsg.desc = '北美外教在线教学，让孩子轻松认读新单词！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/phonics' + Math.ceil(Math.random() * 100);
      break;
    case 'two':
      shareMsg.title = '【久趣五月2人班】￥360/8次课，严选北美外教在线上课';
      shareMsg.desc = '4-12岁适用，2人成团，严选北美外教在线上课，创造趣味十足的课堂体验。';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/two' + Math.ceil(Math.random() * 100);
      break;
    case 'summer':
      shareMsg.title = '【久趣暑假第一波 |￥168/10节课，在家和北美外教学英语';
      shareMsg.desc = '4-12岁使用，4人成团，严选北美外教在线授课，创造趣味十足的课堂体验。';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/summer' + Math.ceil(Math.random() * 100);
      break;
    case 'summers':
      shareMsg.title = '久趣8月福利|暑假第二波 ￥168/10节课';
      shareMsg.desc = '4-12岁使用，4人成团，在家和北美外教学英语。';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/summers' + Math.ceil(Math.random() * 100);
      break;
    case 'summer2s':
      shareMsg.title = '久趣暑期特惠｜¥168/10节课，在家和北美外教学英语！';
      shareMsg.desc = '适合4-12岁，零基础的小朋友也可轻松学会！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/summer2s' + Math.ceil(Math.random() * 100);
      break;
    case 'summer3s':
      shareMsg.title = '久趣暑期特惠｜¥168/10节课，在家和北美外教学英语！';
      shareMsg.desc = '适合4-12岁，零基础的小朋友也可轻松学会！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/summer3s' + Math.ceil(Math.random() * 100);
      break;
    case 'insect':
      shareMsg.title = '19.9元4节「久趣昆虫主题课」北美外教带你探索"昆虫的秘密"！';
      shareMsg.desc = '4-12岁，三人成团，在线上课。一起走进奥妙的昆虫世界，get纯正美语！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/insect' + Math.ceil(Math.random() * 100);
      break;
    case 'invite':
      shareMsg.title = '送你1节孩子最爱的北美外教课，免费哟~';
      shareMsg.desc = '快来跟我们做同学吧~';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/invite' + Math.ceil(Math.random() * 100);
      break;
    case 'lottery':
      shareMsg.title = '【久趣福利】1元抢3节北美外教课！';
      shareMsg.desc = '100%北美外教在线教学，让孩子爱上英语！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/lottery' + Math.ceil(Math.random() * 100);
      shareMsg.imgUrl = 'https://static-app.97kid.com/site-student/public/mobile/campaign/lottery/img/share.jpg';
      break;
    case '1v1':
      shareMsg.title = '【5折福利】久趣1对1北美精英外教在线教学，仅500名额！';
      shareMsg.desc = '适合4-12岁，专属外教固定时间，让孩子爱上英语！';
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/one' + Math.ceil(Math.random() * 100);
      shareMsg.imgUrl = 'https://static-app.97kid.com/site-student/public/mobile/campaign/1v1/img/share.jpg';
      break;
    default:
      shareMsg.title = '【Qkids久趣】4-12岁，在家跟北美外教学英语，新用户100元体验！';
      shareMsg.desc = '严选北美外教在线授课，创造趣味十足的课堂体验，让孩子爱学更有效。';
      shareMsg.link = options.link || window.location.protocol + '//' + window.location.host + '/wx';
      break;
  }

  function patchShareMsg(shareMsg, target) {
    var defaultSuccessFunction = shareMsg.success;
    return {
      title: shareMsg.title,
      desc: shareMsg.desc,
      link: shareMsg.link,
      imgUrl: shareMsg.imgUrl,
      success: function success() {
        if (window.AV && window.AV.analytics instanceof Function) {
          var appId = 'antYy9lOFi5mkU9QKjtYmRLM-gzGzoHsz';
          var appKey = 'jqyWxLyobpsmdwsJddJlDheb';

          var analytics = window.AV.analytics({
            appId: appId,
            appKey: appKey,
            channel: 'weixin'
          });
          analytics.send({
            event: 'share',
            attr: {
              url: shareMsg.link,
              target: target
            }
          });
        }
        if (defaultSuccessFunction && typeof defaultSuccessFunction == 'function') {
          defaultSuccessFunction.call(this, target);
        }
      },
      cancel: shareMsg.cancel
    };
  }

  //初始化分享接口
  checkWxExist() && wx.ready(function () {
    wx.onMenuShareTimeline(patchShareMsg(shareMsg, 'timeline'));
    wx.onMenuShareAppMessage(patchShareMsg(shareMsg, 'appMessage'));
    wx.onMenuShareQQ(patchShareMsg(shareMsg, 'QQ'));
    wx.onMenuShareQZone(patchShareMsg(shareMsg, 'QZone'));
  });

  //登陆用户分享接口
  WxConfig.prototype.activeShare = function (shareFlag, camParas, _shareMsg) {
    // campaign 将逐步弃用掉, 改成使用_shareMsg控制
    var extraParas = '';
    for (var para in camParas) {
      extraParas += '&' + para + '=' + camParas[para];
    }
    if (campaign !== undefined && campaign !== '') {
      if (random === undefined) random = true;
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx/' + campaign;
      if (random) {
        shareMsg.link += '/' + Math.ceil(Math.random() * 100);
      }
      shareMsg.link += '?_r=' + shareFlag + extraParas;
    } else {
      shareMsg.link = window.location.protocol + '//' + window.location.host + '/wx?_r=' + shareFlag + extraParas;
    }

    // 今后都将采用_shareMsg控制, _shareMsg将会覆盖上面的配置
    if (_shareMsg) {
      shareMsg = {
        title: _shareMsg.title || shareMsg.title,
        desc: _shareMsg.desc || shareMsg.desc,
        link: _shareMsg.link || shareMsg.link,
        imgUrl: _shareMsg.imgUrl || shareMsg.imgUrl,
        success: _shareMsg.success || shareMsg.success,
        fail: _shareMsg.fail || shareMsg.fail
      };
    }
    checkWxExist() && wx.ready(function () {
      wx.onMenuShareTimeline(patchShareMsg(shareMsg, 'timeline'));
      wx.onMenuShareAppMessage(patchShareMsg(shareMsg, 'appMessage'));
      wx.onMenuShareQQ(patchShareMsg(shareMsg, 'QQ'));
      wx.onMenuShareQZone(patchShareMsg(shareMsg, 'QZone'));
    });
  };

  WxConfig.prototype.pay = function (billId, pId, options, campUrl) {
    checkWxExist() && wx.ready(function () {
      wx.chooseWXPay({
        timestamp: options.timeStamp,
        nonceStr: options.nonceStr,
        package: options.package,
        signType: options.signType,
        paySign: options.paySign,

        // 支付成功后的回调函数
        success: function success(res) {
          if (options.success && typeof options.success === 'function') {
            if (options.success(res)) return;
          }
          if (options.redirect && typeof options.redirect === 'string') {
            if (options.redirect !== '') window.location.href = options.redirect;
          } else {
            //是否为活动
            if (typeof campUrl !== 'undefined') {
              window.location.href = '/wx/verifypayment/' + pId + '?out_trade_no=' + billId + '&campUrl=' + campUrl;
            } else {
              window.location.href = '/wx/verifypayment/' + pId + '?out_trade_no=' + billId;
            }
          }
        },
        // 支付失败后的回调函数
        fail: function fail(res) {
          $.toastAlert('微信支付唤起失败: ' + JSON.stringify(res));
          if (options.fail || options.fail instanceof Function) options.fail(res);
        }
      });
    });
  };
}

/* Zepto v1.0 - polyfill zepto detect event ajax form fx - zeptojs.com/license */
!function (a) {
  String.prototype.trim === a && (String.prototype.trim = function () {
    return this.replace(/^\s+|\s+$/g, "");
  }), Array.prototype.reduce === a && (Array.prototype.reduce = function (b) {
    if (void 0 === this || null === this) throw new TypeError();var c,
        d = Object(this),
        e = d.length >>> 0,
        f = 0;if ("function" != typeof b) throw new TypeError();if (0 == e && 1 == arguments.length) throw new TypeError();if (arguments.length >= 2) c = arguments[1];else for (;;) {
      if (f in d) {
        c = d[f++];break;
      }if (++f >= e) throw new TypeError();
    }for (; e > f;) {
      f in d && (c = b.call(a, c, d[f], f, d)), f++;
    }return c;
  });
}();var Zepto = function () {
  function a(a) {
    return null == a ? String(a) : W[X.call(a)] || "object";
  }function b(b) {
    return "function" == a(b);
  }function c(a) {
    return null != a && a == a.window;
  }function d(a) {
    return null != a && a.nodeType == a.DOCUMENT_NODE;
  }function e(b) {
    return "object" == a(b);
  }function f(a) {
    return e(a) && !c(a) && a.__proto__ == Object.prototype;
  }function g(a) {
    return a instanceof Array;
  }function h(a) {
    return "number" == typeof a.length;
  }function i(a) {
    return E.call(a, function (a) {
      return null != a;
    });
  }function j(a) {
    return a.length > 0 ? y.fn.concat.apply([], a) : a;
  }function k(a) {
    return a.replace(/::/g, "/").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/_/g, "-").toLowerCase();
  }function l(a) {
    return a in H ? H[a] : H[a] = new RegExp("(^|\\s)" + a + "(\\s|$)");
  }function m(a, b) {
    return "number" != typeof b || J[k(a)] ? b : b + "px";
  }function n(a) {
    var b, c;return G[a] || (b = F.createElement(a), F.body.appendChild(b), c = I(b, "").getPropertyValue("display"), b.parentNode.removeChild(b), "none" == c && (c = "block"), G[a] = c), G[a];
  }function o(a) {
    return "children" in a ? D.call(a.children) : y.map(a.childNodes, function (a) {
      return 1 == a.nodeType ? a : void 0;
    });
  }function p(a, b, c) {
    for (x in b) {
      c && (f(b[x]) || g(b[x])) ? (f(b[x]) && !f(a[x]) && (a[x] = {}), g(b[x]) && !g(a[x]) && (a[x] = []), p(a[x], b[x], c)) : b[x] !== w && (a[x] = b[x]);
    }
  }function q(a, b) {
    return b === w ? y(a) : y(a).filter(b);
  }function r(a, c, d, e) {
    return b(c) ? c.call(a, d, e) : c;
  }function s(a, b, c) {
    null == c ? a.removeAttribute(b) : a.setAttribute(b, c);
  }function t(a, b) {
    var c = a.className,
        d = c && c.baseVal !== w;return b === w ? d ? c.baseVal : c : void (d ? c.baseVal = b : a.className = b);
  }function u(a) {
    var b;try {
      return a ? "true" == a || ("false" == a ? !1 : "null" == a ? null : isNaN(b = Number(a)) ? /^[\[\{]/.test(a) ? y.parseJSON(a) : a : b) : a;
    } catch (c) {
      return a;
    }
  }function v(a, b) {
    b(a);for (var c in a.childNodes) {
      v(a.childNodes[c], b);
    }
  }var w,
      x,
      y,
      z,
      A,
      B,
      C = [],
      D = C.slice,
      E = C.filter,
      F = window.document,
      G = {},
      H = {},
      I = F.defaultView.getComputedStyle,
      J = { "column-count": 1, columns: 1, "font-weight": 1, "line-height": 1, opacity: 1, "z-index": 1, zoom: 1 },
      K = /^\s*<(\w+|!)[^>]*>/,
      L = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,
      M = /^(?:body|html)$/i,
      N = ["val", "css", "html", "text", "data", "width", "height", "offset"],
      O = ["after", "prepend", "before", "append"],
      P = F.createElement("table"),
      Q = F.createElement("tr"),
      R = { tr: F.createElement("tbody"), tbody: P, thead: P, tfoot: P, td: Q, th: Q, "*": F.createElement("div") },
      S = /complete|loaded|interactive/,
      T = /^\.([\w-]+)$/,
      U = /^#([\w-]*)$/,
      V = /^[\w-]+$/,
      W = {},
      X = W.toString,
      Y = {},
      Z = F.createElement("div");return Y.matches = function (a, b) {
    if (!a || 1 !== a.nodeType) return !1;var c = a.webkitMatchesSelector || a.mozMatchesSelector || a.oMatchesSelector || a.matchesSelector;if (c) return c.call(a, b);var d,
        e = a.parentNode,
        f = !e;return f && (e = Z).appendChild(a), d = ~Y.qsa(e, b).indexOf(a), f && Z.removeChild(a), d;
  }, A = function A(a) {
    return a.replace(/-+(.)?/g, function (a, b) {
      return b ? b.toUpperCase() : "";
    });
  }, B = function B(a) {
    return E.call(a, function (b, c) {
      return a.indexOf(b) == c;
    });
  }, Y.fragment = function (a, b, c) {
    a.replace && (a = a.replace(L, "<$1></$2>")), b === w && (b = K.test(a) && RegExp.$1), b in R || (b = "*");var d,
        e,
        g = R[b];return g.innerHTML = "" + a, e = y.each(D.call(g.childNodes), function () {
      g.removeChild(this);
    }), f(c) && (d = y(e), y.each(c, function (a, b) {
      N.indexOf(a) > -1 ? d[a](b) : d.attr(a, b);
    })), e;
  }, Y.Z = function (a, b) {
    return a = a || [], a.__proto__ = y.fn, a.selector = b || "", a;
  }, Y.isZ = function (a) {
    return a instanceof Y.Z;
  }, Y.init = function (a, c) {
    if (a) {
      if (b(a)) return y(F).ready(a);if (Y.isZ(a)) return a;var d;if (g(a)) d = i(a);else if (e(a)) d = [f(a) ? y.extend({}, a) : a], a = null;else if (K.test(a)) d = Y.fragment(a.trim(), RegExp.$1, c), a = null;else {
        if (c !== w) return y(c).find(a);d = Y.qsa(F, a);
      }return Y.Z(d, a);
    }return Y.Z();
  }, y = function y(a, b) {
    return Y.init(a, b);
  }, y.extend = function (a) {
    var b,
        c = D.call(arguments, 1);return "boolean" == typeof a && (b = a, a = c.shift()), c.forEach(function (c) {
      p(a, c, b);
    }), a;
  }, Y.qsa = function (a, b) {
    var c;return d(a) && U.test(b) ? (c = a.getElementById(RegExp.$1)) ? [c] : [] : 1 !== a.nodeType && 9 !== a.nodeType ? [] : D.call(T.test(b) ? a.getElementsByClassName(RegExp.$1) : V.test(b) ? a.getElementsByTagName(b) : a.querySelectorAll(b));
  }, y.contains = function (a, b) {
    return a !== b && a.contains(b);
  }, y.type = a, y.isFunction = b, y.isWindow = c, y.isArray = g, y.isPlainObject = f, y.isEmptyObject = function (a) {
    var b;for (b in a) {
      return !1;
    }return !0;
  }, y.inArray = function (a, b, c) {
    return C.indexOf.call(b, a, c);
  }, y.camelCase = A, y.trim = function (a) {
    return a.trim();
  }, y.uuid = 0, y.support = {}, y.expr = {}, y.map = function (a, b) {
    var c,
        d,
        e,
        f = [];if (h(a)) for (d = 0; d < a.length; d++) {
      c = b(a[d], d), null != c && f.push(c);
    } else for (e in a) {
      c = b(a[e], e), null != c && f.push(c);
    }return j(f);
  }, y.each = function (a, b) {
    var c, d;if (h(a)) {
      for (c = 0; c < a.length; c++) {
        if (b.call(a[c], c, a[c]) === !1) return a;
      }
    } else for (d in a) {
      if (b.call(a[d], d, a[d]) === !1) return a;
    }return a;
  }, y.grep = function (a, b) {
    return E.call(a, b);
  }, window.JSON && (y.parseJSON = JSON.parse), y.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function (a, b) {
    W["[object " + b + "]"] = b.toLowerCase();
  }), y.fn = { forEach: C.forEach, reduce: C.reduce, push: C.push, sort: C.sort, indexOf: C.indexOf, concat: C.concat, map: function map(a) {
      return y(y.map(this, function (b, c) {
        return a.call(b, c, b);
      }));
    }, slice: function slice() {
      return y(D.apply(this, arguments));
    }, ready: function ready(a) {
      return S.test(F.readyState) ? a(y) : F.addEventListener("DOMContentLoaded", function () {
        a(y);
      }, !1), this;
    }, get: function get(a) {
      return a === w ? D.call(this) : this[a >= 0 ? a : a + this.length];
    }, toArray: function toArray() {
      return this.get();
    }, size: function size() {
      return this.length;
    }, remove: function remove() {
      return this.each(function () {
        null != this.parentNode && this.parentNode.removeChild(this);
      });
    }, each: function each(a) {
      return C.every.call(this, function (b, c) {
        return a.call(b, c, b) !== !1;
      }), this;
    }, filter: function filter(a) {
      return b(a) ? this.not(this.not(a)) : y(E.call(this, function (b) {
        return Y.matches(b, a);
      }));
    }, add: function add(a, b) {
      return y(B(this.concat(y(a, b))));
    }, is: function is(a) {
      return this.length > 0 && Y.matches(this[0], a);
    }, not: function not(a) {
      var c = [];if (b(a) && a.call !== w) this.each(function (b) {
        a.call(this, b) || c.push(this);
      });else {
        var d = "string" == typeof a ? this.filter(a) : h(a) && b(a.item) ? D.call(a) : y(a);this.forEach(function (a) {
          d.indexOf(a) < 0 && c.push(a);
        });
      }return y(c);
    }, has: function has(a) {
      return this.filter(function () {
        return e(a) ? y.contains(this, a) : y(this).find(a).size();
      });
    }, eq: function eq(a) {
      return -1 === a ? this.slice(a) : this.slice(a, +a + 1);
    }, first: function first() {
      var a = this[0];return a && !e(a) ? a : y(a);
    }, last: function last() {
      var a = this[this.length - 1];return a && !e(a) ? a : y(a);
    }, find: function find(a) {
      var b,
          c = this;return b = "object" == (typeof a === "undefined" ? "undefined" : _typeof(a)) ? y(a).filter(function () {
        var a = this;return C.some.call(c, function (b) {
          return y.contains(b, a);
        });
      }) : 1 == this.length ? y(Y.qsa(this[0], a)) : this.map(function () {
        return Y.qsa(this, a);
      });
    }, closest: function closest(a, b) {
      var c = this[0],
          e = !1;for ("object" == (typeof a === "undefined" ? "undefined" : _typeof(a)) && (e = y(a)); c && !(e ? e.indexOf(c) >= 0 : Y.matches(c, a));) {
        c = c !== b && !d(c) && c.parentNode;
      }return y(c);
    }, parents: function parents(a) {
      for (var b = [], c = this; c.length > 0;) {
        c = y.map(c, function (a) {
          return (a = a.parentNode) && !d(a) && b.indexOf(a) < 0 ? (b.push(a), a) : void 0;
        });
      }return q(b, a);
    }, parent: function parent(a) {
      return q(B(this.pluck("parentNode")), a);
    }, children: function children(a) {
      return q(this.map(function () {
        return o(this);
      }), a);
    }, contents: function contents() {
      return this.map(function () {
        return D.call(this.childNodes);
      });
    }, siblings: function siblings(a) {
      return q(this.map(function (a, b) {
        return E.call(o(b.parentNode), function (a) {
          return a !== b;
        });
      }), a);
    }, empty: function empty() {
      return this.each(function () {
        this.innerHTML = "";
      });
    }, pluck: function pluck(a) {
      return y.map(this, function (b) {
        return b[a];
      });
    }, show: function show() {
      return this.each(function () {
        "none" == this.style.display && (this.style.display = null), "none" == I(this, "").getPropertyValue("display") && (this.style.display = n(this.nodeName));
      });
    }, replaceWith: function replaceWith(a) {
      return this.before(a).remove();
    }, wrap: function wrap(a) {
      var c = b(a);if (this[0] && !c) var d = y(a).get(0),
          e = d.parentNode || this.length > 1;return this.each(function (b) {
        y(this).wrapAll(c ? a.call(this, b) : e ? d.cloneNode(!0) : d);
      });
    }, wrapAll: function wrapAll(a) {
      if (this[0]) {
        y(this[0]).before(a = y(a));for (var b; (b = a.children()).length;) {
          a = b.first();
        }y(a).append(this);
      }return this;
    }, wrapInner: function wrapInner(a) {
      var c = b(a);return this.each(function (b) {
        var d = y(this),
            e = d.contents(),
            f = c ? a.call(this, b) : a;e.length ? e.wrapAll(f) : d.append(f);
      });
    }, unwrap: function unwrap() {
      return this.parent().each(function () {
        y(this).replaceWith(y(this).children());
      }), this;
    }, clone: function clone() {
      return this.map(function () {
        return this.cloneNode(!0);
      });
    }, hide: function hide() {
      return this.css("display", "none");
    }, toggle: function toggle(a) {
      return this.each(function () {
        var b = y(this);(a === w ? "none" == b.css("display") : a) ? b.show() : b.hide();
      });
    }, prev: function prev(a) {
      return y(this.pluck("previousElementSibling")).filter(a || "*");
    }, next: function next(a) {
      return y(this.pluck("nextElementSibling")).filter(a || "*");
    }, html: function html(a) {
      return a === w ? this.length > 0 ? this[0].innerHTML : null : this.each(function (b) {
        var c = this.innerHTML;y(this).empty().append(r(this, a, b, c));
      });
    }, text: function text(a) {
      return a === w ? this.length > 0 ? this[0].textContent : null : this.each(function () {
        this.textContent = a;
      });
    }, attr: function attr(a, b) {
      var c;return "string" == typeof a && b === w ? 0 == this.length || 1 !== this[0].nodeType ? w : "value" == a && "INPUT" == this[0].nodeName ? this.val() : !(c = this[0].getAttribute(a)) && a in this[0] ? this[0][a] : c : this.each(function (c) {
        if (1 === this.nodeType) if (e(a)) for (x in a) {
          s(this, x, a[x]);
        } else s(this, a, r(this, b, c, this.getAttribute(a)));
      });
    }, removeAttr: function removeAttr(a) {
      return this.each(function () {
        1 === this.nodeType && s(this, a);
      });
    }, prop: function prop(a, b) {
      return b === w ? this[0] && this[0][a] : this.each(function (c) {
        this[a] = r(this, b, c, this[a]);
      });
    }, data: function data(a, b) {
      var c = this.attr("data-" + k(a), b);return null !== c ? u(c) : w;
    }, val: function val(a) {
      return a === w ? this[0] && (this[0].multiple ? y(this[0]).find("option").filter(function (a) {
        return this.selected;
      }).pluck("value") : this[0].value) : this.each(function (b) {
        this.value = r(this, a, b, this.value);
      });
    }, offset: function offset(a) {
      if (a) return this.each(function (b) {
        var c = y(this),
            d = r(this, a, b, c.offset()),
            e = c.offsetParent().offset(),
            f = { top: d.top - e.top, left: d.left - e.left };"static" == c.css("position") && (f.position = "relative"), c.css(f);
      });if (0 == this.length) return null;var b = this[0].getBoundingClientRect();return { left: b.left + window.pageXOffset, top: b.top + window.pageYOffset, width: Math.round(b.width), height: Math.round(b.height) };
    }, css: function css(b, c) {
      if (arguments.length < 2 && "string" == typeof b) return this[0] && (this[0].style[A(b)] || I(this[0], "").getPropertyValue(b));var d = "";if ("string" == a(b)) c || 0 === c ? d = k(b) + ":" + m(b, c) : this.each(function () {
        this.style.removeProperty(k(b));
      });else for (x in b) {
        b[x] || 0 === b[x] ? d += k(x) + ":" + m(x, b[x]) + ";" : this.each(function () {
          this.style.removeProperty(k(x));
        });
      }return this.each(function () {
        this.style.cssText += ";" + d;
      });
    }, index: function index(a) {
      return a ? this.indexOf(y(a)[0]) : this.parent().children().indexOf(this[0]);
    }, hasClass: function hasClass(a) {
      return C.some.call(this, function (a) {
        return this.test(t(a));
      }, l(a));
    }, addClass: function addClass(a) {
      return this.each(function (b) {
        z = [];var c = t(this),
            d = r(this, a, b, c);d.split(/\s+/g).forEach(function (a) {
          y(this).hasClass(a) || z.push(a);
        }, this), z.length && t(this, c + (c ? " " : "") + z.join(" "));
      });
    }, removeClass: function removeClass(a) {
      return this.each(function (b) {
        return a === w ? t(this, "") : (z = t(this), r(this, a, b, z).split(/\s+/g).forEach(function (a) {
          z = z.replace(l(a), " ");
        }), void t(this, z.trim()));
      });
    }, toggleClass: function toggleClass(a, b) {
      return this.each(function (c) {
        var d = y(this),
            e = r(this, a, c, t(this));e.split(/\s+/g).forEach(function (a) {
          (b === w ? !d.hasClass(a) : b) ? d.addClass(a) : d.removeClass(a);
        });
      });
    }, scrollTop: function scrollTop() {
      return this.length ? "scrollTop" in this[0] ? this[0].scrollTop : this[0].scrollY : void 0;
    }, position: function position() {
      if (this.length) {
        var a = this[0],
            b = this.offsetParent(),
            c = this.offset(),
            d = M.test(b[0].nodeName) ? { top: 0, left: 0 } : b.offset();return c.top -= parseFloat(y(a).css("margin-top")) || 0, c.left -= parseFloat(y(a).css("margin-left")) || 0, d.top += parseFloat(y(b[0]).css("border-top-width")) || 0, d.left += parseFloat(y(b[0]).css("border-left-width")) || 0, { top: c.top - d.top, left: c.left - d.left };
      }
    }, offsetParent: function offsetParent() {
      return this.map(function () {
        for (var a = this.offsetParent || F.body; a && !M.test(a.nodeName) && "static" == y(a).css("position");) {
          a = a.offsetParent;
        }return a;
      });
    } }, y.fn.detach = y.fn.remove, ["width", "height"].forEach(function (a) {
    y.fn[a] = function (b) {
      var e,
          f = this[0],
          g = a.replace(/./, function (a) {
        return a[0].toUpperCase();
      });return b === w ? c(f) ? f["inner" + g] : d(f) ? f.documentElement["offset" + g] : (e = this.offset()) && e[a] : this.each(function (c) {
        f = y(this), f.css(a, r(this, b, c, f[a]()));
      });
    };
  }), O.forEach(function (b, c) {
    var d = c % 2;y.fn[b] = function () {
      var b,
          e,
          f = y.map(arguments, function (c) {
        return b = a(c), "object" == b || "array" == b || null == c ? c : Y.fragment(c);
      }),
          g = this.length > 1;return f.length < 1 ? this : this.each(function (a, b) {
        e = d ? b : b.parentNode, b = 0 == c ? b.nextSibling : 1 == c ? b.firstChild : 2 == c ? b : null, f.forEach(function (a) {
          if (g) a = a.cloneNode(!0);else if (!e) return y(a).remove();v(e.insertBefore(a, b), function (a) {
            null == a.nodeName || "SCRIPT" !== a.nodeName.toUpperCase() || a.type && "text/javascript" !== a.type || a.src || window.eval.call(window, a.innerHTML);
          });
        });
      });
    }, y.fn[d ? b + "To" : "insert" + (c ? "Before" : "After")] = function (a) {
      return y(a)[b](this), this;
    };
  }), Y.Z.prototype = y.fn, Y.uniq = B, Y.deserializeValue = u, y.zepto = Y, y;
}();window.Zepto = Zepto, "$" in window || (window.$ = Zepto), function (a) {
  function b(a) {
    var b = this.os = {},
        c = this.browser = {},
        d = a.match(/WebKit\/([\d.]+)/),
        e = a.match(/(Android)\s+([\d.]+)/),
        f = a.match(/(iPad).*OS\s([\d_]+)/),
        g = !f && a.match(/(iPhone\sOS)\s([\d_]+)/),
        h = a.match(/(webOS|hpwOS)[\s\/]([\d.]+)/),
        i = h && a.match(/TouchPad/),
        j = a.match(/Kindle\/([\d.]+)/),
        k = a.match(/Silk\/([\d._]+)/),
        l = a.match(/(BlackBerry).*Version\/([\d.]+)/),
        m = a.match(/(BB10).*Version\/([\d.]+)/),
        n = a.match(/(RIM\sTablet\sOS)\s([\d.]+)/),
        o = a.match(/PlayBook/),
        p = a.match(/Chrome\/([\d.]+)/) || a.match(/CriOS\/([\d.]+)/),
        q = a.match(/Firefox\/([\d.]+)/);(c.webkit = !!d) && (c.version = d[1]), e && (b.android = !0, b.version = e[2]), g && (b.ios = b.iphone = !0, b.version = g[2].replace(/_/g, ".")), f && (b.ios = b.ipad = !0, b.version = f[2].replace(/_/g, ".")), h && (b.webos = !0, b.version = h[2]), i && (b.touchpad = !0), l && (b.blackberry = !0, b.version = l[2]), m && (b.bb10 = !0, b.version = m[2]), n && (b.rimtabletos = !0, b.version = n[2]), o && (c.playbook = !0), j && (b.kindle = !0, b.version = j[1]), k && (c.silk = !0, c.version = k[1]), !k && b.android && a.match(/Kindle Fire/) && (c.silk = !0), p && (c.chrome = !0, c.version = p[1]), q && (c.firefox = !0, c.version = q[1]), b.tablet = !!(f || o || e && !a.match(/Mobile/) || q && a.match(/Tablet/)), b.phone = !(b.tablet || !(e || g || h || l || m || p && a.match(/Android/) || p && a.match(/CriOS\/([\d.]+)/) || q && a.match(/Mobile/)));
  }b.call(a, navigator.userAgent), a.__detect = b;
}(Zepto), function (a) {
  function b(a) {
    return a._zid || (a._zid = n++);
  }function c(a, c, f, g) {
    if (c = d(c), c.ns) var h = e(c.ns);return (m[b(a)] || []).filter(function (a) {
      return a && (!c.e || a.e == c.e) && (!c.ns || h.test(a.ns)) && (!f || b(a.fn) === b(f)) && (!g || a.sel == g);
    });
  }function d(a) {
    var b = ("" + a).split(".");return { e: b[0], ns: b.slice(1).sort().join(" ") };
  }function e(a) {
    return new RegExp("(?:^| )" + a.replace(" ", " .* ?") + "(?: |$)");
  }function f(b, c, d) {
    "string" != a.type(b) ? a.each(b, d) : b.split(/\s/).forEach(function (a) {
      d(a, c);
    });
  }function g(a, b) {
    return a.del && ("focus" == a.e || "blur" == a.e) || !!b;
  }function h(a) {
    return p[a] || a;
  }function i(c, e, i, j, k, l) {
    var n = b(c),
        o = m[n] || (m[n] = []);f(e, i, function (b, e) {
      var f = d(b);f.fn = e, f.sel = j, f.e in p && (e = function e(b) {
        var c = b.relatedTarget;return !c || c !== this && !a.contains(this, c) ? f.fn.apply(this, arguments) : void 0;
      }), f.del = k && k(e, b);var i = f.del || e;f.proxy = function (a) {
        var b = i.apply(c, [a].concat(a.data));return b === !1 && (a.preventDefault(), a.stopPropagation()), b;
      }, f.i = o.length, o.push(f), c.addEventListener(h(f.e), f.proxy, g(f, l));
    });
  }function j(a, d, e, i, j) {
    var k = b(a);f(d || "", e, function (b, d) {
      c(a, b, d, i).forEach(function (b) {
        delete m[k][b.i], a.removeEventListener(h(b.e), b.proxy, g(b, j));
      });
    });
  }function k(b) {
    var c,
        d = { originalEvent: b };for (c in b) {
      s.test(c) || void 0 === b[c] || (d[c] = b[c]);
    }return a.each(t, function (a, c) {
      d[a] = function () {
        return this[c] = q, b[a].apply(b, arguments);
      }, d[c] = r;
    }), d;
  }function l(a) {
    if (!("defaultPrevented" in a)) {
      a.defaultPrevented = !1;var b = a.preventDefault;a.preventDefault = function () {
        this.defaultPrevented = !0, b.call(this);
      };
    }
  }var m = (a.zepto.qsa, {}),
      n = 1,
      o = {},
      p = { mouseenter: "mouseover", mouseleave: "mouseout" };o.click = o.mousedown = o.mouseup = o.mousemove = "MouseEvents", a.event = { add: i, remove: j }, a.proxy = function (c, d) {
    if (a.isFunction(c)) {
      var e = function e() {
        return c.apply(d, arguments);
      };return e._zid = b(c), e;
    }if ("string" == typeof d) return a.proxy(c[d], c);throw new TypeError("expected function");
  }, a.fn.bind = function (a, b) {
    return this.each(function () {
      i(this, a, b);
    });
  }, a.fn.unbind = function (a, b) {
    return this.each(function () {
      j(this, a, b);
    });
  }, a.fn.one = function (a, b) {
    return this.each(function (c, d) {
      i(this, a, b, null, function (a, b) {
        return function () {
          var c = a.apply(d, arguments);return j(d, b, a), c;
        };
      });
    });
  };var q = function q() {
    return !0;
  },
      r = function r() {
    return !1;
  },
      s = /^([A-Z]|layer[XY]$)/,
      t = { preventDefault: "isDefaultPrevented", stopImmediatePropagation: "isImmediatePropagationStopped", stopPropagation: "isPropagationStopped" };a.fn.delegate = function (b, c, d) {
    return this.each(function (e, f) {
      i(f, c, d, b, function (c) {
        return function (d) {
          var e,
              g = a(d.target).closest(b, f).get(0);return g ? (e = a.extend(k(d), { currentTarget: g, liveFired: f }), c.apply(g, [e].concat([].slice.call(arguments, 1)))) : void 0;
        };
      });
    });
  }, a.fn.undelegate = function (a, b, c) {
    return this.each(function () {
      j(this, b, c, a);
    });
  }, a.fn.live = function (b, c) {
    return a(document.body).delegate(this.selector, b, c), this;
  }, a.fn.die = function (b, c) {
    return a(document.body).undelegate(this.selector, b, c), this;
  }, a.fn.on = function (b, c, d) {
    return !c || a.isFunction(c) ? this.bind(b, c || d) : this.delegate(c, b, d);
  }, a.fn.off = function (b, c, d) {
    return !c || a.isFunction(c) ? this.unbind(b, c || d) : this.undelegate(c, b, d);
  }, a.fn.trigger = function (b, c) {
    return ("string" == typeof b || a.isPlainObject(b)) && (b = a.Event(b)), l(b), b.data = c, this.each(function () {
      "dispatchEvent" in this && this.dispatchEvent(b);
    });
  }, a.fn.triggerHandler = function (b, d) {
    var e, f;return this.each(function (g, h) {
      e = k("string" == typeof b ? a.Event(b) : b), e.data = d, e.target = h, a.each(c(h, b.type || b), function (a, b) {
        return f = b.proxy(e), e.isImmediatePropagationStopped() ? !1 : void 0;
      });
    }), f;
  }, "focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function (b) {
    a.fn[b] = function (a) {
      return a ? this.bind(b, a) : this.trigger(b);
    };
  }), ["focus", "blur"].forEach(function (b) {
    a.fn[b] = function (a) {
      return a ? this.bind(b, a) : this.each(function () {
        try {
          this[b]();
        } catch (a) {}
      }), this;
    };
  }), a.Event = function (a, b) {
    "string" != typeof a && (b = a, a = b.type);var c = document.createEvent(o[a] || "Events"),
        d = !0;if (b) for (var e in b) {
      "bubbles" == e ? d = !!b[e] : c[e] = b[e];
    }return c.initEvent(a, d, !0, null, null, null, null, null, null, null, null, null, null, null, null), c.isDefaultPrevented = function () {
      return this.defaultPrevented;
    }, c;
  };
}(Zepto), function (a) {
  function b(b, c, d) {
    var e = a.Event(c);return a(b).trigger(e, d), !e.defaultPrevented;
  }function c(a, c, d, e) {
    return a.global ? b(c || s, d, e) : void 0;
  }function d(b) {
    b.global && 0 === a.active++ && c(b, null, "ajaxStart");
  }function e(b) {
    b.global && ! --a.active && c(b, null, "ajaxStop");
  }function f(a, b) {
    var d = b.context;return b.beforeSend.call(d, a, b) === !1 || c(b, d, "ajaxBeforeSend", [a, b]) === !1 ? !1 : void c(b, d, "ajaxSend", [a, b]);
  }function g(a, b, d) {
    var e = d.context,
        f = "success";d.success.call(e, a, f, b), c(d, e, "ajaxSuccess", [b, d, a]), i(f, b, d);
  }function h(a, b, d, e) {
    var f = e.context;e.error.call(f, d, b, a), c(e, f, "ajaxError", [d, e, a]), i(b, d, e);
  }function i(a, b, d) {
    var f = d.context;d.complete.call(f, b, a), c(d, f, "ajaxComplete", [b, d]), e(d);
  }function j() {}function k(a) {
    return a && (a = a.split(";", 2)[0]), a && (a == x ? "html" : a == w ? "json" : u.test(a) ? "script" : v.test(a) && "xml") || "text";
  }function l(a, b) {
    return (a + "&" + b).replace(/[&?]{1,2}/, "?");
  }function m(b) {
    b.processData && b.data && "string" != a.type(b.data) && (b.data = a.param(b.data, b.traditional)), !b.data || b.type && "GET" != b.type.toUpperCase() || (b.url = l(b.url, b.data));
  }function n(b, c, d, e) {
    var f = !a.isFunction(c);return { url: b, data: f ? c : void 0, success: f ? a.isFunction(d) ? d : void 0 : c, dataType: f ? e || d : d };
  }function o(b, c, d, e) {
    var f,
        g = a.isArray(c);a.each(c, function (c, h) {
      f = a.type(h), e && (c = d ? e : e + "[" + (g ? "" : c) + "]"), !e && g ? b.add(h.name, h.value) : "array" == f || !d && "object" == f ? o(b, h, d, c) : b.add(c, h);
    });
  }var p,
      q,
      r = 0,
      s = window.document,
      t = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
      u = /^(?:text|application)\/javascript/i,
      v = /^(?:text|application)\/xml/i,
      w = "application/json",
      x = "text/html",
      y = /^\s*$/;a.active = 0, a.ajaxJSONP = function (b) {
    if (!("type" in b)) return a.ajax(b);var c,
        d = "jsonp" + ++r,
        e = s.createElement("script"),
        i = function i() {
      clearTimeout(c), a(e).remove(), delete window[d];
    },
        k = function k(a) {
      i(), a && "timeout" != a || (window[d] = j), h(null, a || "abort", l, b);
    },
        l = { abort: k };return f(l, b) === !1 ? (k("abort"), !1) : (window[d] = function (a) {
      i(), g(a, l, b);
    }, e.onerror = function () {
      k("error");
    }, e.src = b.url.replace(/=\?/, "=" + d), a("head").append(e), b.timeout > 0 && (c = setTimeout(function () {
      k("timeout");
    }, b.timeout)), l);
  }, a.ajaxSettings = { type: "GET", beforeSend: j, success: j, error: j, complete: j, context: null, global: !0, xhr: function xhr() {
      return new window.XMLHttpRequest();
    }, accepts: { script: "text/javascript, application/javascript", json: w, xml: "application/xml, text/xml", html: x, text: "text/plain" }, crossDomain: !1, timeout: 0, processData: !0, cache: !0 }, a.ajax = function (b) {
    var c = a.extend({}, b || {});for (p in a.ajaxSettings) {
      void 0 === c[p] && (c[p] = a.ajaxSettings[p]);
    }d(c), c.crossDomain || (c.crossDomain = /^([\w-]+:)?\/\/([^\/]+)/.test(c.url) && RegExp.$2 != window.location.host), c.url || (c.url = window.location.toString()), m(c), c.cache === !1 && (c.url = l(c.url, "_=" + Date.now()));var e = c.dataType,
        i = /=\?/.test(c.url);if ("jsonp" == e || i) return i || (c.url = l(c.url, "callback=?")), a.ajaxJSONP(c);var n,
        o = c.accepts[e],
        r = {},
        s = /^([\w-]+:)\/\//.test(c.url) ? RegExp.$1 : window.location.protocol,
        t = c.xhr();c.crossDomain || (r["X-Requested-With"] = "XMLHttpRequest"), o && (r.Accept = o, o.indexOf(",") > -1 && (o = o.split(",", 2)[0]), t.overrideMimeType && t.overrideMimeType(o)), (c.contentType || c.contentType !== !1 && c.data && "GET" != c.type.toUpperCase()) && (r["Content-Type"] = c.contentType || "application/x-www-form-urlencoded"), c.headers = a.extend(r, c.headers || {}), t.onreadystatechange = function () {
      if (4 == t.readyState) {
        t.onreadystatechange = j, clearTimeout(n);var b,
            d = !1;if (t.status >= 200 && t.status < 300 || 304 == t.status || 0 == t.status && "file:" == s) {
          e = e || k(t.getResponseHeader("content-type")), b = t.responseText;try {
            "script" == e ? (1, eval)(b) : "xml" == e ? b = t.responseXML : "json" == e && (b = y.test(b) ? null : a.parseJSON(b));
          } catch (f) {
            d = f;
          }d ? h(d, "parsererror", t, c) : g(b, t, c);
        } else h(null, t.status ? "error" : "abort", t, c);
      }
    };var u = "async" in c ? c.async : !0;t.open(c.type, c.url, u);for (q in c.headers) {
      t.setRequestHeader(q, c.headers[q]);
    }return f(t, c) === !1 ? (t.abort(), !1) : (c.timeout > 0 && (n = setTimeout(function () {
      t.onreadystatechange = j, t.abort(), h(null, "timeout", t, c);
    }, c.timeout)), t.send(c.data ? c.data : null), t);
  }, a.get = function (b, c, d, e) {
    return a.ajax(n.apply(null, arguments));
  }, a.post = function (b, c, d, e) {
    var f = n.apply(null, arguments);return f.type = "POST", a.ajax(f);
  }, a.getJSON = function (b, c, d) {
    var e = n.apply(null, arguments);return e.dataType = "json", a.ajax(e);
  }, a.fn.load = function (b, c, d) {
    if (!this.length) return this;var e,
        f = this,
        g = b.split(/\s/),
        h = n(b, c, d),
        i = h.success;return g.length > 1 && (h.url = g[0], e = g[1]), h.success = function (b) {
      f.html(e ? a("<div>").html(b.replace(t, "")).find(e) : b), i && i.apply(f, arguments);
    }, a.ajax(h), this;
  };var z = encodeURIComponent;a.param = function (a, b) {
    var c = [];return c.add = function (a, b) {
      this.push(z(a) + "=" + z(b));
    }, o(c, a, b), c.join("&").replace(/%20/g, "+");
  };
}(Zepto), function (a) {
  a.fn.serializeArray = function () {
    var b,
        c = [];return a(Array.prototype.slice.call(this.get(0).elements)).each(function () {
      b = a(this);var d = b.attr("type");"fieldset" != this.nodeName.toLowerCase() && !this.disabled && "submit" != d && "reset" != d && "button" != d && ("radio" != d && "checkbox" != d || this.checked) && c.push({ name: b.attr("name"), value: b.val() });
    }), c;
  }, a.fn.serialize = function () {
    var a = [];return this.serializeArray().forEach(function (b) {
      a.push(encodeURIComponent(b.name) + "=" + encodeURIComponent(b.value));
    }), a.join("&");
  }, a.fn.submit = function (b) {
    if (b) this.bind("submit", b);else if (this.length) {
      var c = a.Event("submit");this.eq(0).trigger(c), c.defaultPrevented || this.get(0).submit();
    }return this;
  };
}(Zepto), function (a, b) {
  function c(a) {
    return d(a.replace(/([a-z])([A-Z])/, "$1-$2"));
  }function d(a) {
    return a.toLowerCase();
  }function e(a) {
    return f ? f + a : d(a);
  }var f,
      g,
      h,
      i,
      j,
      k,
      l,
      m,
      n = "",
      o = { Webkit: "webkit", Moz: "", O: "o", ms: "MS" },
      p = window.document,
      q = p.createElement("div"),
      r = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
      s = {};a.each(o, function (a, c) {
    return q.style[a + "TransitionProperty"] !== b ? (n = "-" + d(a) + "-", f = c, !1) : void 0;
  }), g = n + "transform", s[h = n + "transition-property"] = s[i = n + "transition-duration"] = s[j = n + "transition-timing-function"] = s[k = n + "animation-name"] = s[l = n + "animation-duration"] = s[m = n + "animation-timing-function"] = "", a.fx = { off: f === b && q.style.transitionProperty === b, speeds: { _default: 400, fast: 200, slow: 600 }, cssPrefix: n, transitionEnd: e("TransitionEnd"), animationEnd: e("AnimationEnd") }, a.fn.animate = function (b, c, d, e) {
    return a.isPlainObject(c) && (d = c.easing, e = c.complete, c = c.duration), c && (c = ("number" == typeof c ? c : a.fx.speeds[c] || a.fx.speeds._default) / 1e3), this.anim(b, c, d, e);
  }, a.fn.anim = function (d, e, f, n) {
    var o,
        p,
        _q,
        t = {},
        u = "",
        v = this,
        w = a.fx.transitionEnd;if (e === b && (e = .4), a.fx.off && (e = 0), "string" == typeof d) t[k] = d, t[l] = e + "s", t[m] = f || "linear", w = a.fx.animationEnd;else {
      p = [];for (o in d) {
        r.test(o) ? u += o + "(" + d[o] + ") " : (t[o] = d[o], p.push(c(o)));
      }u && (t[g] = u, p.push(g)), e > 0 && "object" == (typeof d === "undefined" ? "undefined" : _typeof(d)) && (t[h] = p.join(", "), t[i] = e + "s", t[j] = f || "linear");
    }return _q = function q(b) {
      if ("undefined" != typeof b) {
        if (b.target !== b.currentTarget) return;a(b.target).unbind(w, _q);
      }a(this).css(s), n && n.call(this);
    }, e > 0 && this.bind(w, _q), this.size() && this.get(0).clientLeft, this.css(t), 0 >= e && setTimeout(function () {
      v.each(function () {
        _q.call(this);
      });
    }, 0), this;
  }, q = null;
}(Zepto);
;(function ($, undefined) {
  var document = window.document,
      origShow = $.fn.show,
      origHide = $.fn.hide,
      origToggle = $.fn.toggle;

  function anim(el, speed, opacity, scale, callback) {
    if (typeof speed == 'function' && !callback) callback = speed, speed = undefined;
    var props = { opacity: opacity };
    if (scale) {
      props.scale = scale;
      el.css($.fx.cssPrefix + 'transform-origin', '0 0');
    }
    return el.animate(props, speed, null, callback);
  }

  function hide(el, speed, scale, callback) {
    return anim(el, speed, 0, scale, function () {
      origHide.call($(this));
      callback && callback.call(this);
    });
  }

  $.fn.show = function (speed, callback) {
    origShow.call(this);
    if (speed === undefined) speed = 0;else this.css('opacity', 0);
    return anim(this, speed, 1, '1,1', callback);
  };

  $.fn.hide = function (speed, callback) {
    if (speed === undefined) return origHide.call(this);else return hide(this, speed, '0,0', callback);
  };

  $.fn.toggle = function (speed, callback) {
    if (speed === undefined || typeof speed == 'boolean') return origToggle.call(this, speed);else return this.each(function () {
      var el = $(this);
      el[el.css('display') == 'none' ? 'show' : 'hide'](speed, callback);
    });
  };

  $.fn.fadeTo = function (speed, opacity, callback) {
    return anim(this, speed, opacity, null, callback);
  };

  $.fn.fadeIn = function (speed, callback) {
    var target = this.css('opacity');
    if (target > 0) this.css('opacity', 0);else target = 1;
    return origShow.call(this).fadeTo(speed, target, callback);
  };

  $.fn.fadeOut = function (speed, callback) {
    return hide(this, speed, null, callback);
  };

  $.fn.fadeToggle = function (speed, callback) {
    return this.each(function () {
      var el = $(this);
      el[el.css('opacity') == 0 || el.css('display') == 'none' ? 'fadeIn' : 'fadeOut'](speed, callback);
    });
  };

  $.toastAlert = function (Msg, status) {
    if (status === 1) {
      $('#alertBox').removeClass('wrong-input').addClass('success-toast');
    } else {
      $('#alertBox').removeClass('success-toast').addClass('wrong-input');
    }
    $('#alertBox').text(Msg).fadeIn();

    setTimeout(function () {
      $('#alertBox').fadeOut();
    }, 3000);
  };

  $.fn.outerWidth = function (margin) {
    var elem = this;
    if (elem) {
      var size = elem.height();
      if (margin) {
        size += parseFloat(elem.css('margin-left'));
        size += parseFloat(elem.css('margin-right'));
      }
      return size;
    } else {
      return null;
    }
  };

  $.fn.outerHeight = function (margin) {
    var elem = this;
    if (elem) {
      var size = elem.height();
      if (margin) {
        size += parseFloat(elem.css('margin-top'));
        size += parseFloat(elem.css('margin-bottom'));
      }
      return size;
    } else {
      return null;
    }
  };
})(window.Zepto);
var config = {
  APPID: 'wx27900e3078720b6f',
  socialType: 'wx-jqfx',
  apiUrl: 'https://gate.97kid.com',
  staticUrl: 'https://gstatic.97kid.com',
  requestTimeout: 20000,
  appId: 'antYy9lOFi5mkU9QKjtYmRLM-gzGzoHsz',
  appKey: 'jqyWxLyobpsmdwsJddJlDheb'
};

var utils = function ($) {
  return {
    noop: function noop() {},
    setBackUrl: function setBackUrl(url) {
      window.history.pushState(null, '', window.location.href);
      window.addEventListener('popstate', function () {
        window.location.href = url;
      }, false);
    },
    isEmpty: function isEmpty(obj) {
      if (obj === null) return true;
      var type = Object.prototype.toString.call(obj);
      if (type === '[object Array]' || type === '[object String]') {
        return obj.length === 0;
      }
      if (type === '[object Number]') {
        return obj === 0;
      }
      for (var name in obj) {
        return false;
      }
      return true;
    },
    getQueryString: function getQueryString(name) {
      var r1 = getMatched(name, window.location.search);
      if (r1) return r1;
      var key = arguments[1];
      if (key) {
        return getMatched(name, window.localStorage.getItem(key));
      }
      return null;

      function getMatched(name, string) {
        if (string) {
          var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
          var len = string.indexOf('?') == 0 ? 1 : 0;
          var r = string.substr(len).match(reg);
          if (r != null) return unescape(r[2]);
        }
        return null;
      }
    },
    isWeChat: function isWeChat() {
      return (/(MicroMessenger)/i.test(navigator.userAgent)
      );
    },
    isIOS: function isIOS() {
      return (/iPad|iPhone|iPod/.test(navigator.platform)
      );
    },
    isIosWebView: function isIosWebView() {
      return (/iPad|iPhone|iPod/.test(navigator.platform) && navigator.userAgent.indexOf('Safari') === -1
      );
    },
    isAndroid: function isAndroid() {
      return (/(android)/i.test(navigator.userAgent)
      );
    },
    isAndroidWebView: function isAndroidWebView() {
      return (/(android)/i.test(navigator.userAgent) && (typeof android === "undefined" ? "undefined" : _typeof(android)) === 'object'
      );
    },
    isWebView: function isWebView() {
      return utils.isIosWebView() || utils.isAndroidWebView();
    },
    isMobile: function isMobile() {
      return utils.isIOS() || utils.isAndroid();
    },
    parseUrlParam: function parseUrlParam(key) {
      var match,
          pl = /\+/g,
          // Regex for replacing addition symbol with a space
      search = /([^&=]+)=?([^&]*)/g,
          decode = function decode(s) {
        return decodeURIComponent(s.replace(pl, ' '));
      },
          query = window.location.search.substring(1),
          params = {};
      while (match = search.exec(query)) {
        params[decode(match[1])] = decode(match[2]);
      }return key ? params[key] : params;
    },
    parseUrlHash: function parseUrlHash(key) {
      var match,
          pl = /\+/g,
          // Regex for replacing addition symbol with a space
      search = /([^&=]+)=?([^&]*)/g,
          decode = function decode(s) {
        return decodeURIComponent(s.replace(pl, ' '));
      },
          query = window.location.hash.substring(1),
          params = {};
      while (match = search.exec(query)) {
        params[decode(match[1])] = decode(match[2]);
      }return key ? params[key] : params;
    },
    saveUrlParam: function saveUrlParam() {
      var param = utils.getUrlParam();
      try {
        if (param) {
          var state = Math.random().toString().slice(-6);
          delete param.state;
          delete param.code;
          window.localStorage.setItem('param_' + state, JSON.stringify(param));
          console.log('save url param: ', param);
          return '&state=' + state;
        }
      } catch (e) {}
      return '';
    },
    recoverUrlParam: function recoverUrlParam() {
      var state = utils.getUrlParam('state');
      try {
        var param = JSON.parse(window.localStorage.getItem('param_' + state));
        delete param.state;
        delete param.code;
        utils.setUrlParam(param);
        window.localStorage.removeItem('param_' + state);
        return param;
      } catch (e) {}
    },
    getUrlParam: function getUrlParam(key) {
      return utils.parseUrlParam(key);
    },
    getUrlHash: function getUrlHash(key) {
      return utils.parseUrlHash(key);
    },
    getUrlParamWithState: function getUrlParamWithState(key) {
      if (utils.parseUrlParam(key)) return utils.parseUrlParam(key);else if (utils.parseUrlParam('state')) {
        try {
          return JSON.parse(utils.base64ToUtf8(utils.getUrlParam('state')))[key];
        } catch (e) {
          return '';
        }
      }
      return '';
    },
    toUrlParam: function toUrlParam(obj) {
      var arr = [];
      for (var key in obj) {
        arr.push(key + '=' + encodeURIComponent(obj[key]));
      }
      return arr.join('&');
    },
    toUrlHash: function toUrlHash(obj) {
      var arr = [];
      for (var key in obj) {
        arr.push(key + '=' + encodeURIComponent(obj[key]));
      }
      return arr.join('&');
    },
    /**
     * 删除指定url参数
     * @param key
     */
    deleteUrlParam: function deleteUrlParam(key) {
      var params = utils.getUrlParam();
      if (params[key]) {
        delete params[key];
        window.history.pushState(null, null, location.pathname + '?' + utils.toUrlParam(params));
      }
    },
    /**
     * 更新url参数
     * @param key
     */
    updateUrlParam: function updateUrlParam(obj) {
      for (var key in obj) {
        utils.deleteUrlParam(key);
      }window.history.pushState(null, null, location.href + (/\?/.test(location.href) ? '&' : '?') + utils.toUrlParam(obj));
    },
    /**
     * 设置url参数
     * @param key
     */
    setUrlParam: function setUrlParam(obj) {
      var params = utils.getUrlParam();
      for (var key in obj) {
        if (params[key]) {
          var t = {};
          t[key] = obj[key];
          utils.updateUrlParam(t);
        } else {
          var t = {};
          t[key] = obj[key];
          window.history.pushState(null, null, location.href + (/\?/.test(location.href) ? '&' : '?') + utils.toUrlParam(t));
        }
      }
    },
    format: function format(x, y) {
      var z = {
        y: x.getFullYear(),
        M: x.getMonth() + 1,
        d: x.getDate(),
        h: x.getHours(),
        m: x.getMinutes(),
        s: x.getSeconds()
      };
      return y.replace(/(y+|M+|d+|h+|m+|s+)/g, function (v) {
        return ((v.length > 1 ? '0' : '') + eval('z.' + v.slice(-1))).slice(-(v.length > 2 ? v.length : 2));
      });
    },
    showLoading: function showLoading(text) {
      if (document.getElementById('weui-loading_toast')) return;
      var dvMsg = document.createElement('div');
      dvMsg.className = 'weui-loading_toast';
      dvMsg.setAttribute('id', 'weui-loading_toast');
      dvMsg.innerHTML = '<div class="weui-mask_transparent"></div>' + '<div class="weui-toast">' + '    <i class="weui-loading"></i>' + '    <p class="weui-toast__content">' + (text || '正在加载') + '</p>' + '</div>' + '<style>' + '.weui-loading_toast .weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}.weui-loading_toast .weui-toast{position:fixed;z-index:5000;width:32vw;min-height:32vw;top:48vw;left:50%;margin-left:-16vw;background:hsla(0,0%,7%,.7);text-align:center;border-radius:1.333vw;color:#fff;content:"viewport-units-buggyfill; width: 32vw; min-height: 32vw; top: 48vw; margin-left: -16vw; border-radius: 1.333vw"}.weui-loading_toast .weui-toast .weui-loading{margin:5.867vw auto 2.667vw;width:10.133vw;height:10.133vw;vertical-align:baseline;display:inline-block;-webkit-animation:loading-rotate 1s steps(12) infinite;animation:loading-rotate 1s steps(12) infinite;background:transparent url() no-repeat;background-size:100%;content:"viewport-units-buggyfill; margin: 5.867vw auto 2.667vw auto; width: 10.133vw; height: 10.133vw"}@-webkit-keyframes loading-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.weui-loading_toast .weui-toast .weui-toast__content{margin:0 0 4vw;content:"viewport-units-buggyfill; margin: 0 0 4vw"}' + '</style>';
      document.body.appendChild(dvMsg);
    },
    hideLoading: function hideLoading() {
      document.getElementById('weui-loading_toast') && document.getElementById('weui-loading_toast').parentNode.removeChild(document.getElementById('weui-loading_toast'));
    },
    alert: function alert(options, yesText) {
      if (typeof options === 'string') {
        // 兼容直接传字符串作为参数的写法
        options = {
          id: Math.ceil(Math.random() * 1000000000),
          message: options,
          yesText: typeof yesText === 'string' ? yesText : '好的',
          yes: utils.noop,
          mask: true
        };
      } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === 'object') {
        options.id = options.id || Math.ceil(Math.random() * 1000000000);
        options.message = options.message || '确定要这么做吗?';
        options.yesText = options.yesText || '好的';
        options.yes = options.yes || function () {};
        options.mask = !options.mask;
      } else return;

      // 创建提示对话框面板
      var alertMask = document.createElement('div');
      alertMask.setAttribute('id', 'alert-mask-' + options.id);
      alertMask.className = 'alert-mask hidden';
      if (!options.mask) alertMask.style.background = 'transparent';
      alertMask.innerHTML = '<div id="alert-box-' + options.id + '" class="alert hidden">' + '  <div class="title">' + options.message + '</div>' + '  <div id="alert-ok-' + options.id + '" class="button">' + options.yesText + '</div>' + '</div>' + '<style>' + '.alert-mask{position:fixed;top:0;width:100%;height:100%;background:rgba(0,0,0,.8);z-index:1005;overflow:hidden;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity .25s linear 0s;transition:opacity .25s linear 0s}.alert-mask .alert{width:78.667vw;background:#fff;border-radius:2.133vw;text-align:center;-webkit-transition:-webkit-transform .25s linear 0s;transition:-webkit-transform .25s linear 0s;transition:transform .25s linear 0s;transition:transform .25s linear 0s,-webkit-transform .25s linear 0s;content:"viewport-units-buggyfill; width: 78.667vw; border-radius: 2.133vw"}.alert-mask .alert .title{padding:0 5.333vw;min-height:25.6vw;font-size:4.267vw;font-family:VarelaRound-Regular;color:#676c75;line-height:6.4vw;border-bottom:.267vw solid #e7e8ea;content:"viewport-units-buggyfill; padding: 0 5.333vw; min-height: 25.6vw; font-size: 4.267vw; line-height: 6.4vw; border-bottom: 0.267vw solid #e7e8ea"}.alert-mask .alert .button,.alert-mask .alert .title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.alert-mask .alert .button{min-height:15.2vw;font-size:4.8vw;font-family:PingFangSC-Medium;color:#32cdff;line-height:6.667vw;content:"viewport-units-buggyfill; min-height: 15.2vw; font-size: 4.8vw; line-height: 6.667vw"}.alert-mask .alert.show{-webkit-transform:scale(1);transform:scale(1)}.alert-mask .alert.hidden{-webkit-transform:scale(0);transform:scale(0)}.alert-mask.show{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1}.alert-mask.hidden{display:none;opacity:0}' + '</style>';

      add();

      // 绑定点击事件
      document.getElementById('alert-ok-' + options.id).addEventListener('click', remove, false);

      function add() {
        document.body.appendChild(alertMask);
        document.body.style.overflow = 'hidden';
        alertMask.className = 'alert-mask show';
        setTimeout(function () {
          document.getElementById('alert-box-' + options.id).className = 'alert show';
        }, 0);
      }

      function remove() {
        document.getElementById('alert-box-' + options.id).className = 'alert hidden';
        setTimeout(function () {
          alertMask.className = 'alert-mask hidden';
          document.body.style.overflow = 'auto';
          document.body.removeChild(document.getElementById('alert-mask-' + options.id));
          options.yes(true);
        }, 250);
      }
    },
    utf8ToBase64: function utf8ToBase64(str) {
      return btoa(unescape(encodeURIComponent(str)));
    },
    base64ToUtf8: function base64ToUtf8(str) {
      return decodeURIComponent(escape(atob(str)));
    },
    toast: function toast(options) {
      if (typeof options === 'string') {
        // 兼容直接传字符串作为参数的写法
        options = {
          message: options
        };
      } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === 'object') {
        options.message = options.message || '';
      } else return;

      options.id = options.id || Math.ceil(Math.random() * 1000000000);
      options.timer = options.timer || 3000;
      options.callback = options.callback || utils.noop;
      options.mask = options.mask === undefined ? true : Boolean(options.mask);

      // 创建提示对话框面板
      var toastMask = document.createElement('div');
      toastMask.setAttribute('id', 'toast-mask-' + options.id);
      toastMask.className = 'toast-mask hidden';
      if (!options.mask) toastMask.style.background = 'transparent';
      toastMask.innerHTML = '<div id="toast-box-' + options.id + '" class="toast hidden">' + options.message + '</div>' + '<style>' + '.toast-mask{position:fixed;top:0;bottom:0;left:0;right:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;pointer-events:none;z-index:1004}.toast-mask .toast{min-width:45.333vw;max-width:48.667vw;padding:4vw;line-height:5.333vw;color:#fff;background-color:rgba(0,0,0,.5);border-radius:1.333vw;font-size:3.733vw;text-align:center;display:block;z-index:1009;content:"viewport-units-buggyfill; min-width: 45.333vw; max-width: 48.667vw; padding: 4vw; line-height: 5.333vw; border-radius: 1.333vw; font-size: 3.733vw"}.toast-mask .toast.show{-webkit-transform:scale(1);transform:scale(1)}.toast-mask .toast.hidden{-webkit-transform:scale(0);transform:scale(0)}.toast-mask.show{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1}.toast-mask.hidden{display:none;opacity:0}' + '</style>';

      add();
      setTimeout(remove, options.timer);

      function add() {
        document.body.appendChild(toastMask);
        document.body.style.overflow = 'hidden';
        toastMask.className = 'toast-mask show';
        setTimeout(function () {
          document.getElementById('toast-box-' + options.id).className = 'toast show';
        }, 0);
      }

      function remove() {
        document.getElementById('toast-box-' + options.id).className = 'toast hidden';
        setTimeout(function () {
          toastMask.className = 'toast-mask hidden';
          document.body.style.overflow = 'auto';
          document.body.removeChild(document.getElementById('toast-mask-' + options.id));
          options.callback(true);
        }, 250);
      }
    }
  };
}(window.Zepto);(function ($) {
  var config = {
    APPID: 'wx27900e3078720b6f',
    socialType: 'wx-jqfx',
    apiUrl: 'https://gate.97kid.com',
    staticUrl: 'https://gstatic.97kid.com',
    requestTimeout: 20000,
    appId: 'antYy9lOFi5mkU9QKjtYmRLM-gzGzoHsz',
    appKey: 'jqyWxLyobpsmdwsJddJlDheb'
  };
  $.toastAlert = function (Msg, status) {
    if (Msg === '社交账号不存在') return;
    if (Msg === '未登录') return;
    var $box = $('#alertBox');
    if (!$box.length) {
      $('body').append('<div id="alertBox" class="alert-box"></div>');
      $box = $('#alertBox');
    }
    if (status === 2) {
      $box.removeClass('success-toast').addClass('wrong-input');
    } else {
      $box.removeClass('wrong-input').addClass('success-toast');
    }
    $box.html(Msg);
    $box.fadeIn();

    setTimeout(function () {
      $box.fadeOut();
    }, 3000);
  };

  function Account(options) {
    this.options = $.extend({
      returnUrl: window.location.origin + window.location.pathname,
      showRegister: true,
      forceLogin: true
    }, options);
    this.accessKey = 'QKidsAccess';
    this.weChatCodeKey = 'QKidsCode';
    this.weChatCodeTimeKey = 'QKidsCodeTime';
    this.pathnameKey = 'QKidsPathname';
    this.userInfoKey = 'QKidsUserInfo';
    this.referenceKey = 'QKidsReference';
    this.channleKey = 'QKidsChannel';
    this.authCallbackKey = 'QKidsCallback';
    this.openId = 'QKidsOpenId';
    this.token = '';
    this.returnUrl = this.options.returnUrl;
    this.showRegister = this.options.showRegister;
    this.code = '';
    this.forceLogin = this.options.forceLogin;
    this.socialBinded = true;
    this.accountLoading = false;
    this.close = this.options.close !== false;

    var weChatCodeTime = window.localStorage.getItem(this.weChatCodeTimeKey);
    if (weChatCodeTime && weChatCodeTime < new Date().getTime()) {
      this.code = window.localStorage.getItem(this.weChatCodeKey);
    }

    var weChatInfo = navigator.userAgent.match(/MicroMessenger\/([\d\.]+)/i);
    this.inWeChat = !utils.isEmpty(weChatInfo);

    if (this.inWeChat && !utils.getQueryString('code')) {
      window.localStorage.setItem(this.pathnameKey, window.location.search);
    }

    if (utils.getQueryString('_r')) {
      window.localStorage.setItem(this.referenceKey, JSON.stringify({
        rawData: utils.getQueryString('_r'),
        expires: new Date().getTime() / 1000 + 24 * 3600
      }));
    }
    if (utils.getQueryString('_c')) {
      window.localStorage.setItem(this.channleKey, JSON.stringify({
        rawData: utils.getQueryString('_c'),
        expires: new Date().getTime() / 1000 + 24 * 3600
      }));
    }
  }

  // 登录
  Account.prototype.login = function (callback) {
    var self = this;
    self.checkLoginStatus(function (err, authObj) {
      if (err) {
        callback(err);
        self._showLogin(callback);
      } else {
        callback(err, authObj);
      }
    });
  };

  // 获取用户信息
  Account.prototype.getUserInfo = function (callback) {
    var self = this;
    self.checkLoginStatus(function (err) {
      if (err) {
        if (self.forceLogin) {
          self.login(function (err) {
            if (err) callback(err);else self._getUserInfo(callback);
          });
        } else {
          callback(err);
        }
      } else {
        self._getUserInfo(callback);
      }
    });
  };

  Account.prototype.checkLoginStatus = function (callback) {
    var self = this;
    var weChatCode = utils.getQueryString('code');
    if (!weChatCode && window.localStorage.getItem(self.weChatCodeTimeKey) > new Date().getTime()) {
      weChatCode = window.localStorage.getItem(self.weChatCodeKey);
    }
    self.code = weChatCode;
    self._getAccess(function (err, token) {
      if (err) {
        if (self.inWeChat) {
          // 存在from可能为分享消息，code可能与当前账号不符，重新授权
          var from = utils.getQueryString('from');
          if (from && self.forceLogin) {
            return self._getWechatAccess();
          }
          if (weChatCode) {
            window.localStorage.setItem(self.weChatCodeKey, weChatCode);
            window.localStorage.setItem(self.weChatCodeTimeKey, new Date().getTime() + 110 * 60 * 1000);
            self.ajax({
              auth: false,
              type: 'POST',
              path: '/s/user/login/social',
              data: {
                socialCode: weChatCode,
                socialType: config.socialType,
                checkVersion: 0
              },
              success: function success(result) {
                self.socialBinded = true;
                self._saveToken(result);
                self.token = result.access_token;
                self._saveOpenId(result.socialId);
                callback(null, result);
              },
              error: function error(err) {
                self.socialBinded = false;
                callback(err);
              }
            });
          } else {
            if (self.forceLogin) return self._getWechatAccess();
            return callback(err);
          }
        } else {
          callback(err);
        }
      } else {
        callback(null, token);
      }
    });
  };

  Account.prototype.ajax = function (options) {
    var self = this;
    var opt = $.extend({
      auth: true
    }, options);
    if (opt.auth) {
      self.login(function () {
        opt.headers = $.extend(opt.headers || {}, {
          Authorization: 'Bearer ' + self.token
        });
        self._ajax(opt);
      });
    } else {
      self._ajax(opt);
    }
  };

  Account.prototype._ajax = function (options) {
    if (!options.ignoreLoading) {
      utils.showLoading();
    }
    $.ajax({
      type: options.type || 'GET',
      url: config.apiUrl + options.path,
      data: options.data || {},
      headers: options.headers || {},
      dataType: 'json',
      async: options.async,
      timeout: config.requestTimeout,
      success: function success(result) {
        if (!options.ignoreLoading) {
          utils.hideLoading();
        }
        if (options.success) options.success(result);
      },
      error: function error(xhr, errorType, _error) {
        if (!options.ignoreLoading) {
          utils.hideLoading();
        }
        var apiError = {};
        try {
          apiError = JSON.parse(xhr.responseText);
        } catch (e) {
          if ($('meta[name="_token"]').attr('content')) {
            $.ajax({
              type: 'POST',
              url: '/wx/error',
              data: {
                type: options.type || 'GET',
                uri: config.apiUrl + options.path,
                data: options.data,
                status: xhr.status,
                errorType: errorType,
                error: _error
              },
              headers: {
                'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
              }
            });
          }
          apiError = { code: 'unknown.error', message: '网络请求错误' };
        }
        if (options.error) options.error(apiError);
      }
    });
  };

  Account.prototype._getUserInfo = function (callback) {
    var self = this;
    self.ajax({
      path: '/s/user',
      success: function success(result) {
        window.localStorage.setItem(self.userInfoKey, JSON.stringify(result));
        $('#current-account').text(result.mobile);
        $('#account-info').show();
        callback(null, result);
      },
      error: function error(err) {
        callback(err);
      }
    });
  };

  Account.prototype._getAccess = function (callback) {
    var self = this;

    if (self.inWeChat) {
      var socialId = window.localStorage.getItem(self.openId);
      if (self.socialBinded && !socialId) return callback({ code: 'error' });
    }

    try {
      var accessString = window.localStorage.getItem(self.accessKey);
      if (!accessString) {
        return callback({ code: 'access.not.exist', message: '未登录' });
      }
      var access = JSON.parse(accessString);
      var token = access.access_token;
      var expireAt = access.expire_at;
      var refreshToken = access.refresh_token;
      self.token = token;
      if (new Date().getTime() / 1000 < expireAt) {
        callback(null, token);
      } else {
        self.ajax({
          auth: false,
          type: 'POST',
          path: '/s/user/refresh',
          data: {
            refresh_token: refreshToken
          },
          success: function success(result) {
            self._saveToken(result);
            self.token = result.access_token;
            callback(null, result.access_token);
          },
          error: function error(err) {
            callback(err);
          }
        });
      }
    } catch (e) {
      callback(e);
    }
  };

  Account.prototype._tryUnbindSocial = function () {
    var self = this;
    var accessString = window.localStorage.getItem(self.accessKey);
    var weChatCode = window.localStorage.getItem(self.weChatCodeKey);
    var weChatCodeTime = window.localStorage.getItem(self.weChatCodeTimeKey);
    if (self.inWeChat && accessString) {
      self.ajax({
        type: 'DELETE',
        path: '/s/user/social/wx-jqfx',
        async: false
      });
    }
    if (self.inWeChat && weChatCodeTime && (!weChatCode || weChatCodeTime < new Date().getTime())) {
      return self._getWechatAccess();
    }
  };

  Account.prototype._saveToken = function (tokenObj) {
    this.token = tokenObj.access_token;
    tokenObj.expire_at = new Date().getTime() / 1000 + tokenObj.expires_in - 600;
    window.localStorage.setItem(this.accessKey, JSON.stringify(tokenObj));
  };

  Account.prototype._saveOpenId = function (openId) {
    window.localStorage.setItem(this.openId, openId);
  };

  Account.prototype._getWechatAccess = function () {
    window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' + config.APPID + '&redirect_uri=' + encodeURI(this.returnUrl) + '&response_type=code&scope=snsapi_userinfo' + utils.saveUrlParam() + '#wechat_redirect';
  };

  Account.prototype.setAuthCallback = function (func) {
    window.localStorage.setItem(this.authCallbackKey, func || '');
  };

  Account.prototype.getAuthCallback = function () {
    return window.localStorage.getItem(this.authCallbackKey);
  };

  Account.prototype._showLogin = function (callback, loginFirst) {
    var self = this;
    if (self.inWeChat) {
      var weChatCode = utils.getQueryString('code');
      if (!weChatCode && window.localStorage.getItem(self.weChatCodeTimeKey) > new Date().getTime()) {
        weChatCode = window.localStorage.getItem(self.weChatCodeKey);
      }
      if (!weChatCode) {
        return self._getWechatAccess();
      }
    }
    var html = '<div id="login" class="login-mask">' + '  <div class="login-box">' + '    <form id="loginForm" class="login-form">' + '      <div class="login-title">手机号登录</div>' + '      <input id="loginMobile" placeholder="手机号" type="tel" maxlength="11">' + '      <input id="loginPassword" placeholder="密码" type="password" maxlength="12">' + '      <div id="loginBtn" class="submit-btn">登录</div>' + '      <div id="forgetPassword">忘记密码?</div>' + '      <div id="switchRegister">注册账号</div>' + '    </form>' + '    <form id="registerForm" class="register-form">' + '      <div class="login-title">新用户注册</div>' + '      <input id="regMobile" placeholder="手机号" type="tel" maxlength="11">' + '      <input id="regSmsCode" placeholder="验证码" type="tel" maxlength="4">' + '      <div id="regSmsBtn" class="send-btn">获取验证码</div>' + '      <input id="regPassword" placeholder="6～12位新密码，数字加字母" type="password" maxlength="12">' + '      <span id="showHideRegPassword" class="hide"></span>' + '      <div id="regBtn" class="submit-btn">注册</div>' + '      <div id="switchLogin">已有账号？<span class="underline">立即登录</span></div>' + '    </form>' + '    <form id="resetForm" class="reset-form">' + '      <div id="backLogin"></div>' + '      <div class="login-title">找回密码</div>' + '      <input id="resetMobile" placeholder="手机号" type="tel" maxlength="11">' + '      <input id="resetSmsCode" placeholder="验证码" type="tel" maxlength="4">' + '      <div id="resetSmsBtn" class="send-btn">获取验证码</div>' + '      <input id="resetPassword" placeholder="6～12位新密码，数字加字母" type="password" maxlength="12">' + '      <span id="showHideResetPassword" class="hide"></span>' + '      <div id="resetBtn" class="submit-btn">完成并登录</div>' + '    </form>' + '  </div>' + '</div>' + '<style>' + '.login-mask{position:fixed;width:100%;height:100%;top:0;background-color:rgba(0,0,0,.8);z-index:1003;overflow:hidden;display:none;font-family:VarelaRound-Regular,PingFangSC-Light,Microsoft YaHei}.login-mask *{-webkit-box-sizing:border-box;box-sizing:border-box}.login-mask .login-box{width:78.667vw;margin:35% auto;overflow:hidden;background-color:#fff;border-radius:3.2vw;position:relative;padding:0;content:"viewport-units-buggyfill; width: 78.667vw; border-radius: 3.2vw"}.login-mask form{margin:8.533vw auto;content:"viewport-units-buggyfill; margin: 8.533vw auto"}.login-mask input{margin:2.133vw auto 0;display:block;width:68vw;height:12.267vw;line-height:normal;font-size:3.733vw;font-family:VarelaRound-Regular;text-indent:5.333vw;outline:none;color:#4b5058;background:#fff;border-radius:6.133vw;border:.267vw solid #f2f2f2;-webkit-appearance:none;-moz-appearance:none;appearance:none;content:"viewport-units-buggyfill; margin: 2.133vw auto 0 auto; width: 68vw; height: 12.267vw; font-size: 3.733vw; text-indent: 5.333vw; border-radius: 6.133vw; border: 0.267vw solid #f2f2f2"}.login-mask input:-ms-input-placeholder,.login-mask input::-ms-input-placeholder{font-weight:300;font-family:PingFangSC-Light;color:#c1c1c1}.login-mask input::-webkit-input-placeholder{font-weight:300;font-family:PingFangSC-Light;color:#c1c1c1}.login-mask input:-ms-input-placeholder,.login-mask input::-ms-input-placeholder{font-weight:300;font-family:PingFangSC-Light;color:#c1c1c1}.login-mask input::placeholder{font-weight:300;font-family:PingFangSC-Light;color:#c1c1c1}.login-mask .login-title{height:7.467vw;margin-bottom:6.4vw;line-height:7.467vw;font-size:5.333vw;font-family:PingFangSC-Medium;color:#4b5058;text-align:center;content:"viewport-units-buggyfill; height: 7.467vw; margin-bottom: 6.4vw; line-height: 7.467vw; font-size: 5.333vw"}.login-mask .submit-btn{display:block;margin:2.133vw auto 0;width:68vw;height:12.8vw;line-height:12.8vw;background:hsla(216,8%,63%,.6);border-radius:6.4vw;font-size:4.267vw;font-family:PingFangSC-Medium;color:#e5e6e9;text-align:center;content:"viewport-units-buggyfill; margin: 2.133vw auto 0 auto; width: 68vw; height: 12.8vw; line-height: 12.8vw; border-radius: 6.4vw; font-size: 4.267vw"}.login-mask .active{background:#32cdff;color:#fff}.login-mask .send-btn{display:inline-block;width:24vw;height:12.8vw;line-height:12.8vw;font-size:3.733vw;font-weight:300;font-family:PingFangSC-Light;color:#4b5058;position:absolute;top:36.8vw;right:5.067vw;content:"viewport-units-buggyfill; width: 24vw; height: 12.8vw; line-height: 12.8vw; font-size: 3.733vw; top: 36.8vw; right: 5.067vw"}.login-mask .underline{text-decoration:underline}.login-mask #forgetPassword{margin:4.267vw 10.933vw 0 17.067vw;color:#999fa8;content:"viewport-units-buggyfill; margin: 4.267vw 10.933vw 0 17.067vw; width: 18.667vw; height: 5.333vw; line-height: 5.333vw; font-size: 3.733vw"}.login-mask #forgetPassword,.login-mask #switchRegister{display:inline-block;width:18.667vw;height:5.333vw;line-height:5.333vw;font-size:3.733vw;font-weight:300;font-family:PingFangSC-Light}.login-mask #switchRegister{color:#4b5058;content:"viewport-units-buggyfill; width: 18.667vw; height: 5.333vw; line-height: 5.333vw; font-size: 3.733vw"}.login-mask #backLogin{position:absolute;top:9.333vw;left:6.667vw;width:6.4vw;height:6.4vw;background:url("");background-size:6.4vw 6.4vw;content:"viewport-units-buggyfill; top: 9.333vw; left: 6.667vw; width: 6.4vw; height: 6.4vw; background-size: 6.4vw 6.4vw"}.login-mask #switchLogin{margin:4.267vw auto 0;text-align:center;height:5.333vw;font-size:3.733vw;font-family:PingFangSC-Regular;color:#4b5058;content:"viewport-units-buggyfill; margin: 4.267vw auto 0 auto; height: 5.333vw; font-size: 3.733vw"}.login-mask #showHideRegPassword,.login-mask #showHideResetPassword{position:absolute;display:block;top:51.2vw;right:5.333vw;width:13.6vw;height:12.267vw;background-size:4.267vw 4.267vw;background-repeat:no-repeat;background-position:4vw 4vw;content:"viewport-units-buggyfill; top: 51.2vw; right: 5.333vw; width: 13.6vw; height: 12.267vw; background-size: 4.267vw 4.267vw; background-position: 4vw 4vw"}.login-mask #showHideRegPassword.show,.login-mask #showHideResetPassword.show{background-image:url("")}.login-mask #showHideRegPassword.hide,.login-mask #showHideResetPassword.hide{background-image:url("")}' + '</style>';

    if (!$('#login').length) $('body').append(html);

    self._initLoginEvent(callback);

    $('#resetForm, #loginForm').css('display', 'none');
    $('#registerForm').css('display', 'block');
    $('.login-mask').css('display', 'block');
    $('body').css({ 'position': 'fixed', 'width': '100%' });
  };

  //限制输入数字
  $.fn.onlyNum = function () {
    $(this).keypress(function (event) {
      var eventObj = event || e;
      var keyCode = eventObj.keyCode || eventObj.which;
      if (keyCode >= 48 && keyCode <= 57) return true;else return false;
    }).focus(function () {
      //禁用输入法
      this.style.imeMode = 'disabled';
    }).bind('paste', function () {
      //获取剪切板的内容
      var clipboard = window.event.clipboardData.getData('text');
      if (/^\d+$/.test(clipboard)) return true;else return false;
    });
  };

  Account.prototype._initLoginEvent = function (callback) {
    if (typeof callback !== 'function') callback = function callback() {};
    var self = this;

    // 表单校验
    $('#login input').off('input change').on('input change', function () {
      if ($('#loginMobile').val().length === 11 && $('#loginPassword').val().length >= 6 && $('#loginPassword').val().length <= 12 && /^[0-9]*$/.test($('#loginMobile').val()) && /^[0-9a-zA-Z]*$/.test($('#loginPassword').val())) {
        $('#loginBtn').addClass('active');
      } else {
        $('#loginBtn').removeClass('active');
      }
      if ($('#regMobile').val().length === 11 && $('#regSmsCode').val().length === 4 && $('#regPassword').val().length >= 6 && $('#regPassword').val().length <= 12 && /^[0-9]*$/.test($('#regMobile').val()) && /^[0-9]*$/.test($('#regSmsCode').val()) && /^[0-9a-zA-Z]*$/.test($('#regPassword').val())) {
        $('#regBtn').addClass('active');
      } else {
        $('#regBtn').removeClass('active');
      }
      if ($('#resetMobile').val().length === 11 && $('#resetSmsCode').val().length === 4 && $('#resetPassword').val().length >= 6 && $('#resetPassword').val().length <= 12 && /^[0-9]*$/.test($('#resetMobile').val()) && /^[0-9]*$/.test($('#resetSmsCode').val()) && /^[0-9a-zA-Z]*$/.test($('#resetPassword').val())) {
        $('#resetBtn').addClass('active');
      } else {
        $('#resetBtn').removeClass('active');
      }
    });

    // 显示隐藏密码
    $('#showHideRegPassword').off('click').on('click', function () {
      if ($('#showHideRegPassword').attr('class') === 'hide') {
        $('#regPassword').attr('type', 'text');
        $('#showHideRegPassword').attr('class', 'show');
      } else {
        $('#regPassword').attr('type', 'password');
        $('#showHideRegPassword').attr('class', 'hide');
      }
    });
    $('#showHideResetPassword').off('click').on('click', function () {
      if ($('#showHideResetPassword').attr('class') === 'hide') {
        $('#resetPassword').attr('type', 'text');
        $('#showHideResetPassword').attr('class', 'show');
      } else {
        $('#resetPassword').attr('type', 'password');
        $('#showHideResetPassword').attr('class', 'hide');
      }
    });

    // 验证码只能是数字
    $('#loginMobile, #regMobile, #resetMobile, #regSmsCode, #resetSmsCode').onlyNum();

    // 清空密码和按钮状态
    $('#loginPassword, #regSmsCode, #regPassword, #resetSmsCode, #resetPassword').val('');
    $('#loginBtn, #regBtn, #resetBtn').removeClass('active');

    // 阻止关闭点击冒泡
    $('.login-box').off('click').on('click', function (e) {
      e.stopPropagation();
    });

    // 已有账号
    $('#switchLogin').off('click').on('click', function () {
      $('#resetForm, #registerForm').css('display', 'none');
      $('#loginForm').css('display', 'block');
    });
    // 还没有账号
    $('#switchRegister').off('click').on('click', function () {
      $('#loginForm, #resetForm').css('display', 'none');
      $('#registerForm').css('display', 'block');
    });
    // 忘记密码
    $('#forgetPassword').off('click').on('click', function () {
      $('#loginForm, #registerForm').css('display', 'none');
      $('#resetForm').css('display', 'block');
    });
    // 返回登录
    $('#backLogin').off('click').on('click', function () {
      $('#resetForm, #registerForm').css('display', 'none');
      $('#loginForm').css('display', 'block');
    });

    // 关闭登录窗口
    $('.login-mask').click(function () {
      if (self.close) {
        $('.login-mask').css('display', 'none');
        $('body').css({ 'position': 'relative' });
      }
    });

    var countdown = 60;

    // 发送注册验证码
    $('#regSmsBtn').off('click').on('click', function () {

      if (countdown !== 60) return;

      var mobile = $.trim($('#regMobile').val());

      if (!checkMobile(mobile)) false;

      self.ajax({
        auth: false,
        type: 'POST',
        path: '/s/user/sms/register',
        data: {
          mobile: mobile
        },
        success: function success() {
          setTime($('#regSmsBtn'));
          utils.toast('验证码已经发送');
        },
        error: function error(_error2) {
          utils.toast(_error2.message);
        }
      });
    });

    // 注册用户
    $('#regBtn').off('click').on('click', function () {
      if (self.accountLoading) return;
      self.accountLoading = true;
      var mobile = $.trim($('#regMobile').val());
      var verifyCode = $.trim($('#regSmsCode').val());
      var password = $.trim($('#regPassword').val());

      //检查手机
      if (!checkMobile(mobile)) {
        self.accountLoading = false;
        return false;
      }

      //检查验证码
      if (verifyCode.length !== 4) {
        utils.toast('手机验证码为4位数字');
        self.accountLoading = false;
        return false;
      }

      //检查密码
      if (!checkPassword(password)) {
        self.accountLoading = false;
        return false;
      }

      //查找reference

      var reference = '';
      try {
        var referenceObj = JSON.parse(window.localStorage.getItem(self.referenceKey));
        if (referenceObj && referenceObj.rawData && new Date().getTime() / 1000 < referenceObj.expires) {
          reference = referenceObj.rawData;
        }
      } catch (e) {
        console.log(e);
      }
      var channel = '';
      try {
        var channelObj = JSON.parse(window.localStorage.getItem(self.channleKey));
        if (channelObj && channelObj.rawData && new Date().getTime() / 1000 < channelObj.expires) {
          channel = channelObj.rawData;
        }
      } catch (e) {
        console.log(e);
      }

      self.ajax({
        auth: false,
        type: 'POST',
        path: self.inWeChat && self.code ? '/s/user/register/withSocial' : '/s/user/register',
        data: {
          mobile: mobile,
          smsCode: verifyCode,
          password: password,
          reference: reference,
          channel: channel,
          socialType: config.socialType,
          socialCode: self.code
        },
        success: function success(data) {
          self.accountLoading = false;
          _hideLogin(mobile);
          self.socialBinded = true;
          self._saveToken(data);
          self._saveOpenId(data.socialId);
          callback(null, data);
        },
        error: function error(err) {
          self.accountLoading = false;
          utils.toast(err.message);
          callback(err);
        }
      });
    });

    // 登录
    $('#loginBtn').off('click').on('click', function () {
      if (self.accountLoading) return;
      self.accountLoading = true;
      var mobile = $.trim($('#loginMobile').val());
      var password = $.trim($('#loginPassword').val());

      if (!checkMobile(mobile)) {
        self.accountLoading = false;
        return false;
      }
      //检查密码
      if (!checkPassword(password)) {
        self.accountLoading = false;
        return false;
      }
      self._tryUnbindSocial();

      self.ajax({
        auth: false,
        type: 'POST',
        path: '/s/user/login',
        data: {
          mobile: mobile,
          password: password,
          checkVersion: 0
        },
        beforeSend: function beforeSend() {
          self.accountLoading = false;
        },
        success: function success(data) {
          self.accountLoading = false;
          _hideLogin(mobile);
          self._saveToken(data);
          if (self.inWeChat) {
            self.ajax({
              type: 'POST',
              path: '/s/user/social',
              data: {
                socialType: config.socialType,
                socialCode: self.code
              },
              success: function success(result) {
                self.socialBinded = true;
                self._saveOpenId(result.socialId);
                callback(null, data);
              }
            });
          } else {
            callback(null, data);
          }
        },
        error: function error(err) {
          self.accountLoading = false;
          utils.toast(err.message);
          $('#loginBtn').find('.loading-icon').show();
          $('#loginBtn').find('.right-arrow-icon').show().siblings('.loading-icon').hide();
        }
      });
    });

    // 发送重设密码验证码
    countdown = 60;
    $('#resetSmsBtn').off('click').on('click', function () {
      if (countdown !== 60) return;

      var mobile = $.trim($('#resetMobile').val());

      if (!checkMobile(mobile)) false;

      self.ajax({
        auth: false,
        type: 'POST',
        path: '/s/user/sms/password',
        data: {
          mobile: mobile
        },
        dataType: 'json',
        success: function success(result) {
          setTime($('#resetSmsBtn'));
          utils.toast('验证码已经发送');
        },
        error: function error(err) {
          utils.toast(err.message);
        }
      });
    });

    //重置密码
    $('#resetBtn').off('click').on('click', function () {
      if (self.accountLoading) return;
      self.accountLoading = true;

      var mobile = $.trim($('#resetMobile').val());
      var verifyCode = $.trim($('#resetSmsCode').val());
      var password = $.trim($('#resetPassword').val());

      //检查手机
      if (!checkMobile(mobile)) {
        self.accountLoading = false;
        return false;
      }

      //检查验证码
      if (verifyCode.length !== 4) {
        utils.toast('手机验证码为4位数字');
        self.accountLoading = false;
        return false;
      }

      //检查密码
      if (!checkPassword(password)) {
        self.accountLoading = false;
        return false;
      }

      self.ajax({
        auth: false,
        type: 'POST',
        path: '/s/user/password/reset',
        data: {
          mobile: mobile,
          smsCode: verifyCode,
          password: password
        },
        success: function success(data) {
          self.accountLoading = false;
          utils.toast('密码成功重置,请登录');
          $('#resetForm, #registerForm').css('display', 'none');
          $('#loginForm').css('display', 'block');
        },

        error: function error(err) {
          self.accountLoading = false;
          utils.toast(err.message);
        }
      });
    });

    //启动计时器
    function setTime(obj) {
      if (countdown === 0) {
        obj.attr('disabled', false);
        obj.text('发送验证码');
        countdown = 60;
        return;
      } else {
        obj.attr('disabled', false);
        obj.text(countdown + 's');
      }
      countdown--;

      setTimeout(function () {
        setTime(obj);
      }, 1000);
    }

    // 检查手机号
    function checkMobile(mobile) {
      var pregMobile = /^1\d{10}$/;
      if ($.trim(mobile) === '') {
        utils.toast('手机号不能为空');
        return false;
      }

      if (!pregMobile.test(mobile)) {
        utils.toast('不是有效的手机号');
        return false;
      }
      return true;
    }

    // 检查密码
    function checkPassword(password) {
      //字段值仅允许字母、数字、破折号（-）以及底线（_）
      var pregPassword = /^[0-9A-Za-z_-]{6,30}$/;
      if (password === '' || password.length < 6 || password.length > 32) {
        utils.toast('密码长度为6-32位');
        return false;
      }

      if (!pregPassword.test(password)) {
        utils.toast('密码长度6到10位,仅允许字母，数字，破折号，底线 ');
        return false;
      }
      return true;
    }

    function _hideLogin(mobile) {
      // 删除本地userid
      localStorage.removeItem('userId');
      utils.toast('成功登录');
      $('.login-mask').css('display', 'none');
      $('body').css({ 'position': 'relative' });

      //记录当前手机号
      localStorage.setItem('mobile', mobile);
      $('#current-account').text(mobile.replace(mobile.substr(3, 4), '****'));
      $('#account-info').show();
    }
  };

  // Account.prototype._getRecommendation = function(callback) {
  //     var self = this;
  //     self.checkLoginStatus(function (err, authObj) {
  //         if (err) {
  //             self._showLogin(callback);
  //         } else {
  //             callback(err, authObj);
  //         }
  //     });
  // };

  Account.init = function (options) {
    return new Account(options);
  };

  if (typeof define === 'function' && _typeof(define.amd) === 'object' && define.amd) {
    define(function () {
      return Account;
    });
  } else if (typeof module !== 'undefined' && module.exports) {
    module.exports = Account.init;
    module.exports.Account = Account;
  }
  window.Account = Account;
})(window.Zepto);

if (!window.utils) window.utils = {};
var _utils = {
  noop: function noop() {},
  setBackUrl: function setBackUrl(url) {
    window.history.pushState(null, '', window.location.href);
    window.addEventListener('popstate', function () {
      window.location.href = url;
    }, false);
  },
  isEmpty: function isEmpty(obj) {
    if (obj === null) return true;
    var type = Object.prototype.toString.call(obj);
    if (type === '[object Array]' || type === '[object String]') {
      return obj.length === 0;
    }
    if (type === '[object Number]') {
      return obj === 0;
    }
    for (var name in obj) {
      return false;
    }
    return true;
  },
  getQueryString: function getQueryString(name) {
    var r1 = getMatched(name, window.location.search);
    if (r1) return r1;
    var key = arguments[1];
    if (key) {
      return getMatched(name, window.localStorage.getItem(key));
    }
    return null;

    function getMatched(name, string) {
      if (string) {
        var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)');
        var len = string.indexOf('?') == 0 ? 1 : 0;
        var r = string.substr(len).match(reg);
        if (r != null) return unescape(r[2]);
      }
      return null;
    }
  },
  isWeChat: function isWeChat() {
    return (/(MicroMessenger)/i.test(navigator.userAgent)
    );
  },
  isIOS: function isIOS() {
    return (/iPad|iPhone|iPod/.test(navigator.platform)
    );
  },
  isIosWebView: function isIosWebView() {
    return (/iPad|iPhone|iPod/.test(navigator.platform) && navigator.userAgent.indexOf('Safari') === -1
    );
  },
  isAndroid: function isAndroid() {
    return (/(android)/i.test(navigator.userAgent)
    );
  },
  isAndroidWebView: function isAndroidWebView() {
    return (/(android)/i.test(navigator.userAgent) && (typeof android === "undefined" ? "undefined" : _typeof(android)) === 'object'
    );
  },
  isWebView: function isWebView() {
    return utils.isIosWebView() || utils.isAndroidWebView();
  },
  isMobile: function isMobile() {
    return utils.isIOS() || utils.isAndroid();
  },
  parseUrlParam: function parseUrlParam(key) {
    var match,
        pl = /\+/g,
        // Regex for replacing addition symbol with a space
    search = /([^&=]+)=?([^&]*)/g,
        decode = function decode(s) {
      return decodeURIComponent(s.replace(pl, ' '));
    },
        query = window.location.search.substring(1),
        params = {};
    while (match = search.exec(query)) {
      params[decode(match[1])] = decode(match[2]);
    }return key ? params[key] : params;
  },
  parseUrlHash: function parseUrlHash(key) {
    var match,
        pl = /\+/g,
        // Regex for replacing addition symbol with a space
    search = /([^&=]+)=?([^&]*)/g,
        decode = function decode(s) {
      return decodeURIComponent(s.replace(pl, ' '));
    },
        query = window.location.hash.substring(1),
        params = {};
    while (match = search.exec(query)) {
      params[decode(match[1])] = decode(match[2]);
    }return key ? params[key] : params;
  },
  saveUrlParam: function saveUrlParam() {
    var param = utils.getUrlParam();
    try {
      if (param) {
        var state = Math.random().toString().slice(-6);
        delete param.state;
        delete param.code;
        window.localStorage.setItem('param_' + state, JSON.stringify(param));
        console.log('save url param: ', param);
        return '&state=' + state;
      }
    } catch (e) {}
    return '';
  },
  recoverUrlParam: function recoverUrlParam() {
    var state = utils.getUrlParam('state');
    try {
      var param = JSON.parse(window.localStorage.getItem('param_' + state));
      delete param.state;
      delete param.code;
      utils.setUrlParam(param);
      window.localStorage.removeItem('param_' + state);
      return param;
    } catch (e) {}
  },
  getUrlParam: function getUrlParam(key) {
    return utils.parseUrlParam(key);
  },
  getUrlHash: function getUrlHash(key) {
    return utils.parseUrlHash(key);
  },
  getUrlParamWithState: function getUrlParamWithState(key) {
    if (utils.parseUrlParam(key)) return utils.parseUrlParam(key);else if (utils.parseUrlParam('state')) {
      try {
        return JSON.parse(utils.base64ToUtf8(utils.getUrlParam('state')))[key];
      } catch (e) {
        return '';
      }
    }
    return '';
  },
  toUrlParam: function toUrlParam(obj) {
    var arr = [];
    for (var key in obj) {
      arr.push(key + '=' + encodeURIComponent(obj[key]));
    }
    return arr.join('&');
  },
  toUrlHash: function toUrlHash(obj) {
    var arr = [];
    for (var key in obj) {
      arr.push(key + '=' + encodeURIComponent(obj[key]));
    }
    return arr.join('&');
  },
  deleteUrlParam: function deleteUrlParam(key) {
    var params = utils.getUrlParam();
    if (params[key]) {
      delete params[key];
      window.history.pushState(null, null, location.pathname + '?' + utils.toUrlParam(params));
    }
  },
  updateUrlParam: function updateUrlParam(obj) {
    for (var key in obj) {
      utils.deleteUrlParam(key);
    }window.history.pushState(null, null, location.href + (/\?/.test(location.href) ? '&' : '?') + utils.toUrlParam(obj));
  },
  setUrlParam: function setUrlParam(obj) {
    var params = utils.getUrlParam();
    for (var key in obj) {
      if (params[key]) {
        var t = {};
        t[key] = obj[key];
        utils.updateUrlParam(t);
      } else {
        var t = {};
        t[key] = obj[key];
        window.history.pushState(null, null, location.href + (/\?/.test(location.href) ? '&' : '?') + utils.toUrlParam(t));
      }
    }
  },
  format: function format(x, y) {
    var z = {
      y: x.getFullYear(),
      M: x.getMonth() + 1,
      d: x.getDate(),
      h: x.getHours(),
      m: x.getMinutes(),
      s: x.getSeconds()
    };
    return y.replace(/(y+|M+|d+|h+|m+|s+)/g, function (v) {
      return ((v.length > 1 ? '0' : '') + eval('z.' + v.slice(-1))).slice(-(v.length > 2 ? v.length : 2));
    });
  },
  alert: function alert(options, yesText) {
    if (typeof options === 'string') {
      // 兼容直接传字符串作为参数的写法
      options = {
        id: Math.ceil(Math.random() * 1000000000),
        message: options,
        yesText: typeof yesText === 'string' ? yesText : '好的',
        yes: utils.noop,
        mask: true
      };
    } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === 'object') {
      options.id = options.id || Math.ceil(Math.random() * 1000000000);
      options.message = options.message || '确定要这么做吗?';
      options.yesText = options.yesText || '好的';
      options.yes = options.yes || function () {};
      options.mask = !options.mask;
    } else return;

    // 创建提示对话框面板
    var alertMask = document.createElement('div');
    alertMask.setAttribute('id', 'alert-mask-' + options.id);
    alertMask.className = 'alert-mask hidden';
    if (!options.mask) alertMask.style.background = 'transparent';
    alertMask.innerHTML = '<div id="alert-box-' + options.id + '" class="alert hidden">' + '  <div class="title">' + options.message + '</div>' + '  <div id="alert-ok-' + options.id + '" class="button">' + options.yesText + '</div>' + '</div>' + '<style>' + '.alert-mask{position:fixed;top:0;width:100%;height:100%;background:rgba(0,0,0,.8);z-index:1005;overflow:hidden;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity .25s linear 0s;transition:opacity .25s linear 0s}.alert-mask .alert{width:78.667vw;background:#fff;border-radius:2.133vw;text-align:center;-webkit-transition:-webkit-transform .25s linear 0s;transition:-webkit-transform .25s linear 0s;transition:transform .25s linear 0s;transition:transform .25s linear 0s,-webkit-transform .25s linear 0s;content:"viewport-units-buggyfill; width: 78.667vw; border-radius: 2.133vw"}.alert-mask .alert .title{padding:0 5.333vw;min-height:25.6vw;font-size:4.267vw;font-family:VarelaRound-Regular;color:#676c75;line-height:6.4vw;border-bottom:.267vw solid #e7e8ea;content:"viewport-units-buggyfill; padding: 0 5.333vw; min-height: 25.6vw; font-size: 4.267vw; line-height: 6.4vw; border-bottom: 0.267vw solid #e7e8ea"}.alert-mask .alert .button,.alert-mask .alert .title{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.alert-mask .alert .button{min-height:15.2vw;font-size:4.8vw;font-family:PingFangSC-Medium;color:#32cdff;line-height:6.667vw;content:"viewport-units-buggyfill; min-height: 15.2vw; font-size: 4.8vw; line-height: 6.667vw"}.alert-mask .alert.show{-webkit-transform:scale(1);transform:scale(1)}.alert-mask .alert.hidden{-webkit-transform:scale(0);transform:scale(0)}.alert-mask.show{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1}.alert-mask.hidden{display:none;opacity:0}' + '</style>';

    add();

    // 绑定点击事件
    document.getElementById('alert-ok-' + options.id).addEventListener('click', remove, false);

    function add() {
      document.body.appendChild(alertMask);
      document.body.style.overflow = 'hidden';
      alertMask.className = 'alert-mask show';
      setTimeout(function () {
        document.getElementById('alert-box-' + options.id).className = 'alert show';
      }, 0);
    }

    function remove() {
      document.getElementById('alert-box-' + options.id).className = 'alert hidden';
      setTimeout(function () {
        alertMask.className = 'alert-mask hidden';
        document.body.style.overflow = 'auto';
        document.body.removeChild(document.getElementById('alert-mask-' + options.id));
        options.yes(true);
      }, 250);
    }
  },
  utf8ToBase64: function utf8ToBase64(str) {
    return btoa(unescape(encodeURIComponent(str)));
  },
  base64ToUtf8: function base64ToUtf8(str) {
    return decodeURIComponent(escape(atob(str)));
  },
  info: function info(options, contentText) {
    if (typeof options === 'string') {
      // 兼容直接传字符串作为参数的写法
      options = {
        title: options,
        content: typeof contentText === 'string' ? contentText : ''
      };
    } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === 'object') {
      options.title = options.title || '';
      options.content = options.content || '';
    } else return;

    options.id = options.id || Math.ceil(Math.random() * 1000000000);
    options.yes = options.yes || utils.noop;
    options.mask = options.mask === undefined ? true : Boolean(options.mask);

    // 创建提示对话框面板
    var infoMask = document.createElement('div');
    infoMask.setAttribute('id', 'info-mask-' + options.id);
    infoMask.className = 'info-mask hidden';
    if (!options.mask) infoMask.style.background = 'transparent';
    infoMask.innerHTML = '<div id="info-box-' + options.id + '" class="info hidden">' + '  <div class="title">' + options.title + '</div>' + '  <div class="content">' + options.content + '</div>' + '  <div id="info-close-' + options.id + '" class="close"></div>' + '</div>' + '<style>' + '.info-mask{position:fixed;top:0;width:100%;height:100%;background:rgba(0,0,0,.8);z-index:1004;overflow:hidden;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-transition:opacity .25s linear 0s;transition:opacity .25s linear 0s}.info-mask .info{width:79.733vw;background:#fff;border-radius:2.133vw;text-align:center;position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition:-webkit-transform .25s linear 0s;transition:-webkit-transform .25s linear 0s;transition:transform .25s linear 0s;transition:transform .25s linear 0s,-webkit-transform .25s linear 0s;padding:6.933vw 7.467vw 8.267vw;color:#333;content:"viewport-units-buggyfill; width: 79.733vw; border-radius: 2.133vw; padding: 6.933vw 7.467vw 8.267vw 7.467vw"}.info-mask .info .title{height:10.4vw;font-size:4.267vw;font-family:PingFangSC-Medium;font-weight:500;content:"viewport-units-buggyfill; height: 10.4vw; font-size: 4.267vw"}.info-mask .info .content{min-height:22.4vw;font-size:3.733vw;font-family:PingFangSC-Regular;font-weight:400;line-height:5.6vw;text-align:left;content:"viewport-units-buggyfill; min-height: 22.4vw; font-size: 3.733vw; line-height: 5.6vw"}.info-mask .info .close{display:inline-block;width:10.133vw;height:10.133vw;margin-left:-5.067vw;position:absolute;bottom:-36.8vw;background:url();background-size:100% 100%;content:"viewport-units-buggyfill; width: 10.133vw; height: 10.133vw; margin-left: -5.067vw; bottom: -36.8vw"}.info-mask .info.show{-webkit-transform:scale(1);transform:scale(1)}.info-mask .info.hidden{-webkit-transform:scale(0);transform:scale(0)}.info-mask.show{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1}.info-mask.hidden{display:none;opacity:0}' + '</style>';

    add();

    // 绑定点击事件
    document.getElementById('info-close-' + options.id).addEventListener('click', remove, false);

    function add() {
      document.body.appendChild(infoMask);
      document.body.style.overflow = 'hidden';
      infoMask.className = 'info-mask show';
      setTimeout(function () {
        document.getElementById('info-box-' + options.id).className = 'info show';
      }, 0);
    }

    function remove() {
      document.getElementById('info-box-' + options.id).className = 'info hidden';
      setTimeout(function () {
        infoMask.className = 'info-mask hidden';
        document.body.style.overflow = 'auto';
        document.body.removeChild(document.getElementById('info-mask-' + options.id));
        options.yes(true);
      }, 250);
    }
  },
  toast: function toast(options) {
    if (typeof options === 'string') {
      // 兼容直接传字符串作为参数的写法
      options = {
        message: options
      };
    } else if ((typeof options === "undefined" ? "undefined" : _typeof(options)) === 'object') {
      options.message = options.message || '';
    } else return;

    options.id = options.id || Math.ceil(Math.random() * 1000000000);
    options.timer = options.timer || 3000;
    options.callback = options.callback || utils.noop;
    options.mask = options.mask === undefined ? true : Boolean(options.mask);

    // 创建提示对话框面板
    var toastMask = document.createElement('div');
    toastMask.setAttribute('id', 'toast-mask-' + options.id);
    toastMask.className = 'toast-mask hidden';
    if (!options.mask) toastMask.style.background = 'transparent';
    toastMask.innerHTML = '<div id="toast-box-' + options.id + '" class="toast hidden">' + options.message + '</div>' + '<style>' + '.toast-mask{position:fixed;top:0;bottom:0;left:0;right:0;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;pointer-events:none;z-index:1004}.toast-mask .toast{min-width:45.333vw;max-width:48.667vw;padding:4vw;line-height:5.333vw;color:#fff;background-color:rgba(0,0,0,.5);border-radius:1.333vw;font-size:3.733vw;text-align:center;display:block;z-index:1009;content:"viewport-units-buggyfill; min-width: 45.333vw; max-width: 48.667vw; padding: 4vw; line-height: 5.333vw; border-radius: 1.333vw; font-size: 3.733vw"}.toast-mask .toast.show{-webkit-transform:scale(1);transform:scale(1)}.toast-mask .toast.hidden{-webkit-transform:scale(0);transform:scale(0)}.toast-mask.show{display:-webkit-box;display:-ms-flexbox;display:flex;opacity:1}.toast-mask.hidden{display:none;opacity:0}' + '</style>';

    add();
    setTimeout(remove, options.timer);

    function add() {
      document.body.appendChild(toastMask);
      document.body.style.overflow = 'hidden';
      toastMask.className = 'toast-mask show';
      setTimeout(function () {
        document.getElementById('toast-box-' + options.id).className = 'toast show';
      }, 0);
    }

    function remove() {
      document.getElementById('toast-box-' + options.id).className = 'toast hidden';
      setTimeout(function () {
        toastMask.className = 'toast-mask hidden';
        document.body.style.overflow = 'auto';
        document.body.removeChild(document.getElementById('toast-mask-' + options.id));
        options.callback(true);
      }, 250);
    }
  },
  showLoading: function showLoading(text) {
    if (document.getElementById('weui-loading_toast')) return;
    var dvMsg = document.createElement('div');
    dvMsg.className = 'weui-loading_toast';
    dvMsg.setAttribute('id', 'weui-loading_toast');
    dvMsg.innerHTML = '<div class="weui-mask_transparent"></div>' + '<div class="weui-toast">' + '    <i class="weui-loading"></i>' + '    <p class="weui-toast__content">' + (text || '正在加载') + '</p>' + '</div>' + '<style>' + '.weui-loading_toast .weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}.weui-loading_toast .weui-toast{position:fixed;z-index:5000;width:32vw;min-height:32vw;top:48vw;left:50%;margin-left:-16vw;background:hsla(0,0%,7%,.7);text-align:center;border-radius:1.333vw;color:#fff;content:"viewport-units-buggyfill; width: 32vw; min-height: 32vw; top: 48vw; margin-left: -16vw; border-radius: 1.333vw"}.weui-loading_toast .weui-toast .weui-loading{margin:5.867vw auto 2.667vw;width:10.133vw;height:10.133vw;vertical-align:baseline;display:inline-block;-webkit-animation:loading-rotate 1s steps(12) infinite;animation:loading-rotate 1s steps(12) infinite;background:transparent url() no-repeat;background-size:100%;content:"viewport-units-buggyfill; margin: 5.867vw auto 2.667vw auto; width: 10.133vw; height: 10.133vw"}@-webkit-keyframes loading-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loading-rotate{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.weui-loading_toast .weui-toast .weui-toast__content{margin:0 0 4vw;content:"viewport-units-buggyfill; margin: 0 0 4vw"}' + '</style>';
    document.body.appendChild(dvMsg);
  },
  hideLoading: function hideLoading() {
    document.getElementById('weui-loading_toast') && document.getElementById('weui-loading_toast').parentNode.removeChild(document.getElementById('weui-loading_toast'));
  },
  initWechatShare: function initWechatShare(defaultInfo) {
    defaultInfo = defaultInfo || {};
    console.log(defaultInfo);
    if (utils.isWeChat() && WxConfig) {
      window.wxconfig = new WxConfig(window.wechatConfig);
      window.shareMsg = function (shareMsgInfo) {
        shareMsgInfo = shareMsgInfo || {};
        shareMsgInfo = {
          title: shareMsgInfo.title || defaultInfo.title || '【Qkids久趣】4-12岁，在家跟北美外教学英语，新用户100元体验！',
          desc: shareMsgInfo.desc || defaultInfo.desc || '严选北美外教在线授课，创造趣味十足的课堂体验，让孩子爱学更有效。',
          link: shareMsgInfo.link || defaultInfo.link || window.location.protocol + '//' + window.location.host + '/wx',
          imgUrl: shareMsgInfo.imgUrl || defaultInfo.imgUrl || 'https://static-app.97kid.com/site-student/public/img/share.png',
          success: shareMsgInfo.success || defaultInfo.success || function (target) {
            analytics && analytics.send({
              event: 'share_success',
              attr: {
                target: target
              }
            });
          }
        };
        console.log(shareMsgInfo);
        return shareMsgInfo;
      };
      window.activeShare = function (shareMsgInfo) {
        window.wxconfig.activeShare('', '', window.shareMsg(shareMsgInfo));
      };
      window.activeShare();
    }
  },
  initAnalytics: function initAnalytics(av) {
    window.av = av;
    window.analytics = AV.analytics({
      appId: 'antYy9lOFi5mkU9QKjtYmRLM-gzGzoHsz',
      appKey: 'jqyWxLyobpsmdwsJddJlDheb',
      channel: utils.isWeChat() ? 'weixin' : ''
    });
  },
  error: function error(err) {
    console.error(err);
    utils.toast(err.message);
  },
  supportPromise: function supportPromise(account) {
    account.$ajax = function (options) {
      return new Promise(function (resolve, reject) {
        if (options.auth === false) account.ajax(_extends({}, options, { success: resolve, error: reject }));else {
          account.forceLogin = true;
          account.getUserInfo(function (err) {
            return !err && account.ajax(_extends({}, options, { success: resolve, error: reject }));
          });
        }
      });
    };
    account.$getUserInfo = function (forceLogin, close) {
      return new Promise(function (resolve) {
        account.close = close !== false;
        account.getUserInfo(function (err, userInfo) {
          if (forceLogin) {
            if (!err && userInfo) resolve(userInfo);
          } else {
            err && console.error(err);
            resolve(userInfo || null);
          }
        });
      });
    };
  },
  goHome: function goHome(vip) {
    if (vip) utils.go('/vip');else if (Account) {
      var account = new Account();
      account.forceLogin = false; // 不强制登录
      account.getUserInfo(function (err, userInfo) {
        if (!err && userInfo && userInfo.isNewUser === false) utils.go('/vip');else utils.go('');
      });
    } else utils.go('');
  },
  go: function go(path) {
    window.location.href = window.location.protocol + '//' + window.location.host + '/wx' + path;
  },
  getAge: function getAge(s) {
    var now = new Date();

    var _s$split = s.split('-'),
        _s$split2 = _slicedToArray(_s$split, 3),
        bY = _s$split2[0],
        bM = _s$split2[1],
        bD = _s$split2[2];

    var _ref = [now.getFullYear(), now.getMonth() + 1, now.getDate()],
        nY = _ref[0],
        nM = _ref[1],
        nD = _ref[2];
    var y = nY - bY,
        m = nM - bM,
        d = nD - bD;

    return y === 0 ? 0 : y > 0 ? m === 0 ? d < 0 ? y - 1 : y : m < 0 ? y - 1 : y : -1;
  }
};
for (var util in _utils) {
  window.utils[util] = _utils[util];
} /**
   * @author wangxiao
   * @date 2015-06-11
   * @homepage http://github.com/leancloud/js-analytics-sdk
   *
   * 每位工程师都有保持代码优雅的义务
   * Each engineer has a duty to keep the code elegant
   */

void function (win) {

  // 当前版本
  var VERSION = '0.0.1';

  // 获取命名空间
  var AV = win.AV || {};
  win.AV = AV;

  // AMD 加载支持
  if (typeof define === 'function' && define.amd) {
    define('AV', [], function () {
      return AV;
    });
  }

  // 命名空间，挂载一些工具方法
  var tool = {};

  // 命名空间，挂载私有方法
  var engine = {};

  var newAnalytics = function newAnalytics(options) {
    var appId = options.appId;
    var appKey = options.appKey;

    // 应用版本
    var appVersion = options.version || null;

    // 推广渠道
    var appChannel = options.channel || null;

    // 分析统计接口
    var apiHost;
    switch (options.region) {
      case 'us':
        apiHost = 'us-api.leancloud.cn';
        break;
      // 默认中国区节点
      default:
        apiHost = 'api.leancloud.cn';
        break;
    }
    var apiUrl = 'https://' + apiHost + '/1.1/stats/open/collect';

    return {

      // 发送统计数据
      send: function send(options, callback) {
        var eventsList = [];

        // 判断是否传入的是有值的数组
        if (options && options.length) {
          eventsList = options;
        }
        // 如果不是数组，那就是对象
        else {

            // 判断参数是否正确
            if (!options || !options.event) {
              throw 'EventObject must have a event value.';
            }

            // 单个事件对象
            var eventObj = {

              // 事件名称
              event: options.event,

              // 事件属性，完全自定义
              attr: options.attr,

              // 持续时长
              duration: options.duration,

              // 内部使用
              tag: options.tag
            };
            eventsList.push(eventObj);
          }

        // 处理下数据
        for (var i = 0, l = eventsList.length; i < l; i++) {
          eventsList[i].attributes = eventsList[i].attr;

          // 清理掉多余字段
          delete eventsList[i].attr;
        }

        var data = {
          client: {
            id: engine.getId(),

            // 服务器端会统一按照小写字母校验
            platform: 'web',
            app_version: appVersion,
            app_channel: appChannel
          },
          session: {
            id: tool.getId()
          },
          events: eventsList
        };

        tool.ajax({
          url: apiUrl,
          method: 'post',
          data: data,
          appId: appId,
          appKey: appKey
        }, function (result, error) {
          if (callback) {
            if (result) {
              callback(result);
            } else {
              callback(error);
            }
          }
        });
      }
    };
  };

  // 主函数
  AV.analytics = function (options) {
    if ((typeof options === "undefined" ? "undefined" : _typeof(options)) !== 'object') {
      throw 'AV.analytics need a argument at least.';
    } else if (!options.appId) {
      throw 'Options must have appId.';
    } else if (!options.appKey) {
      throw 'Options must have appKey.';
    }

    // 创建一个新的实例
    var analyticsObj = newAnalytics(options);

    // 启动自动页面时长统计
    engine.pageView(analyticsObj);

    // 启动自动 session 时长统计
    engine.sessionView(analyticsObj);

    return analyticsObj;
  };

  // 赋值版本号
  AV.analytics.version = VERSION;

  // 挂载私有方法
  AV.analytics._tool = tool;
  AV.analytics._engine = engine;

  engine.getId = function () {
    var key = 'leancloud-analytics-id';
    var id = win.localStorage.getItem(key);
    if (!id) {
      id = tool.getId();
      win.localStorage.setItem(key, id);
    }
    return id;
  };

  // 自动统计页面相关
  engine.pageView = function (analyticsObj) {
    var startTime;
    var endTime;
    var page;

    function start() {
      startTime = tool.now();
      page = win.location.href;
    }

    function end() {
      endTime = tool.now();
      analyticsObj.send({

        // 必须为 _page 表示一次页面访问
        event: '_page',

        // 页面停留时间，单位毫秒
        duration: endTime - startTime,

        // 页面名称
        tag: page
      });
    }

    // 默认自动启动
    start();

    // 监听 url 变化（包括 hash 变化）
    win.addEventListener('hashchange', function (e) {
      // 页面发生变化，发送一次页面统计
      end();
      // 再次启动新的统计
      start();
    });

    // 当页面关闭的时候
    win.addEventListener('beforeunload', function () {
      // 发送一次
      end();
    });
  };

  // 自动统计一次 session 周期的时间
  engine.sessionView = function (analyticsObj) {
    var startTime = tool.now();
    win.addEventListener('beforeunload', function () {
      var endTime = tool.now();
      analyticsObj.send({

        //必须为 _session.close 表示一次使用结束
        event: '_session.close',

        // 使用时长，单位毫秒
        duration: endTime - startTime
      });
    });
  };

  // 获取一个唯一 id
  tool.getId = function () {

    // 与时间相关的随机因子
    var getIdItem = function getIdItem() {
      return new Date().getTime().toString(36) + Math.random().toString(36).substring(2, 3);
    };
    return 'AV' + getIdItem() + getIdItem() + getIdItem();
  };

  // Ajax 请求
  tool.ajax = function (options, callback) {
    var url = options.url;
    var method = options.method || 'get';
    var xhr = new XMLHttpRequest();
    xhr.open(method, url);
    if (method === 'post' || method === 'put') {
      xhr.setRequestHeader('Content-Type', 'application/json');
    }
    if (options.appId) {
      xhr.setRequestHeader('X-AVOSCloud-Application-Id', options.appId);
    }
    if (options.appKey) {
      xhr.setRequestHeader('X-AVOSCloud-Application-Key', options.appKey);
    }
    xhr.onload = function (data) {
      // 检测认为 2xx 的返回都是成功
      if (xhr.status >= 200 && xhr.status < 300) {
        callback(JSON.parse(xhr.responseText));
      } else {
        callback(null, JSON.parse(xhr.responseText));
      }
    };
    xhr.onerror = function (data) {
      callback(null, data);
      throw 'Network error.';
    };
    xhr.send(JSON.stringify(options.data));
  };

  // 获取当前时间的时间戳
  tool.now = function () {
    return new Date().getTime();
  };
}(window);

/******/(function (modules) {
  // webpackBootstrap
  /******/ // The module cache
  /******/var installedModules = {};
  /******/
  /******/ // The require function
  /******/function __webpack_require__(moduleId) {
    /******/
    /******/ // Check if module is in cache
    /******/if (installedModules[moduleId]) {
      /******/return installedModules[moduleId].exports;
      /******/
    }
    /******/ // Create a new module (and put it into the cache)
    /******/var module = installedModules[moduleId] = {
      /******/i: moduleId,
      /******/l: false,
      /******/exports: {}
      /******/ };
    /******/
    /******/ // Execute the module function
    /******/modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
    /******/
    /******/ // Flag the module as loaded
    /******/module.l = true;
    /******/
    /******/ // Return the exports of the module
    /******/return module.exports;
    /******/
  }
  /******/
  /******/
  /******/ // expose the modules object (__webpack_modules__)
  /******/__webpack_require__.m = modules;
  /******/
  /******/ // expose the module cache
  /******/__webpack_require__.c = installedModules;
  /******/
  /******/ // define getter function for harmony exports
  /******/__webpack_require__.d = function (exports, name, getter) {
    /******/if (!__webpack_require__.o(exports, name)) {
      /******/Object.defineProperty(exports, name, {
        /******/configurable: false,
        /******/enumerable: true,
        /******/get: getter
        /******/ });
      /******/
    }
    /******/
  };
  /******/
  /******/ // getDefaultExport function for compatibility with non-harmony modules
  /******/__webpack_require__.n = function (module) {
    /******/var getter = module && module.__esModule ?
    /******/function getDefault() {
      return module['default'];
    } :
    /******/function getModuleExports() {
      return module;
    };
    /******/__webpack_require__.d(getter, 'a', getter);
    /******/return getter;
    /******/
  };
  /******/
  /******/ // Object.prototype.hasOwnProperty.call
  /******/__webpack_require__.o = function (object, property) {
    return Object.prototype.hasOwnProperty.call(object, property);
  };
  /******/
  /******/ // __webpack_public_path__
  /******/__webpack_require__.p = "/";
  /******/
  /******/ // Load entry module and return exports
  /******/return __webpack_require__(__webpack_require__.s = 19);
  /******/
})(
/************************************************************************/
/******/{

  /***/1:
  /***/function _(module, exports, __webpack_require__) {

    eval("module.exports = __webpack_require__(2);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9yZWdlbmVyYXRvci9pbmRleC5qcz81ZjE2Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIiwiZmlsZSI6IjEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJtb2R1bGUuZXhwb3J0cyA9IHJlcXVpcmUoXCJyZWdlbmVyYXRvci1ydW50aW1lXCIpO1xuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvYmFiZWwtcnVudGltZS9yZWdlbmVyYXRvci9pbmRleC5qc1xuLy8gbW9kdWxlIGlkID0gMVxuLy8gbW9kdWxlIGNodW5rcyA9IDAgMSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///1\n");

    /***/
  },

  /***/19:
  /***/function _(module, exports, __webpack_require__) {

    module.exports = __webpack_require__(20);

    /***/
  },

  /***/2:
  /***/function _(module, exports, __webpack_require__) {

    eval("/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// This method of obtaining a reference to the global object needs to be\n// kept identical to the way it is obtained in runtime.js\nvar g = (function() { return this })() || Function(\"return this\")();\n\n// Use `getOwnPropertyNames` because not all browsers support calling\n// `hasOwnProperty` on the global `self` object in a worker. See #183.\nvar hadRuntime = g.regeneratorRuntime &&\n  Object.getOwnPropertyNames(g).indexOf(\"regeneratorRuntime\") >= 0;\n\n// Save the old regeneratorRuntime in case it needs to be restored later.\nvar oldRuntime = hadRuntime && g.regeneratorRuntime;\n\n// Force reevalutation of runtime.js.\ng.regeneratorRuntime = undefined;\n\nmodule.exports = __webpack_require__(3);\n\nif (hadRuntime) {\n  // Restore the original runtime.\n  g.regeneratorRuntime = oldRuntime;\n} else {\n  // Remove the global property added by runtime.js.\n  try {\n    delete g.regeneratorRuntime;\n  } catch(e) {\n    g.regeneratorRuntime = undefined;\n  }\n}\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcmVnZW5lcmF0b3ItcnVudGltZS9ydW50aW1lLW1vZHVsZS5qcz84ZjIxIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0EscUJBQXFCLGNBQWM7O0FBRW5DO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTs7QUFFQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQSxDQUFDO0FBQ0Q7QUFDQTtBQUNBO0FBQ0EsR0FBRztBQUNIO0FBQ0E7QUFDQSIsImZpbGUiOiIyLmpzIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBDb3B5cmlnaHQgKGMpIDIwMTQtcHJlc2VudCwgRmFjZWJvb2ssIEluYy5cbiAqXG4gKiBUaGlzIHNvdXJjZSBjb2RlIGlzIGxpY2Vuc2VkIHVuZGVyIHRoZSBNSVQgbGljZW5zZSBmb3VuZCBpbiB0aGVcbiAqIExJQ0VOU0UgZmlsZSBpbiB0aGUgcm9vdCBkaXJlY3Rvcnkgb2YgdGhpcyBzb3VyY2UgdHJlZS5cbiAqL1xuXG4vLyBUaGlzIG1ldGhvZCBvZiBvYnRhaW5pbmcgYSByZWZlcmVuY2UgdG8gdGhlIGdsb2JhbCBvYmplY3QgbmVlZHMgdG8gYmVcbi8vIGtlcHQgaWRlbnRpY2FsIHRvIHRoZSB3YXkgaXQgaXMgb2J0YWluZWQgaW4gcnVudGltZS5qc1xudmFyIGcgPSAoZnVuY3Rpb24oKSB7IHJldHVybiB0aGlzIH0p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tcbiAgfVxufVxuXG5cblxuLy8vLy8vLy8vLy8vLy8vLy8vXG4vLyBXRUJQQUNLIEZPT1RFUlxuLy8gLi9ub2RlX21vZHVsZXMvcmVnZW5lcmF0b3ItcnVudGltZS9ydW50aW1lLW1vZHVsZS5qc1xuLy8gbW9kdWxlIGlkID0gMlxuLy8gbW9kdWxlIGNodW5rcyA9IDAgMSJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///2\n");

    /***/
  },

  /***/20:
  /***/function _(module, __webpack_exports__, __webpack_require__) {

    "use strict";

    eval("Object.defineProperty(__webpack_exports__, \"__esModule\", { value: true });\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__ = __webpack_require__(1);\n/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator__);\n\n\nvar _this = this;\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nfunction _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step(\"next\", value); }, function (err) { step(\"throw\", err); }); } } return step(\"next\"); }); }; }\n\nutils.recoverUrlParam();\n$(_asyncToGenerator( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee3() {\n\n  // 获取福袋信息\n  var getLuckyBagInfo = function () {\n    var _ref2 = _asyncToGenerator( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee() {\n      var userInfo, luckyBagInfo;\n      return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee$(_context) {\n        while (1) {\n          switch (_context.prev = _context.next) {\n            case 0:\n              userInfo = null, luckyBagInfo = null;\n              _context.prev = 1;\n              _context.next = 4;\n              return account.$getUserInfo();\n\n            case 4:\n              userInfo = _context.sent;\n\n              console.log(userInfo);\n              _context.next = 8;\n              return fetchLuckyBagInfo(userInfo);\n\n            case 8:\n              luckyBagInfo = _context.sent;\n\n              console.log(luckyBagInfo);\n              renderGrabStatus(luckyBagInfo);\n              _context.next = 13;\n              return renderGrabList(luckyBagInfo);\n\n            case 13:\n              _context.next = 18;\n              break;\n\n            case 15:\n              _context.prev = 15;\n              _context.t0 = _context['catch'](1);\n\n              utils.error(_context.t0);\n\n            case 18:\n            case 'end':\n              return _context.stop();\n          }\n        }\n      }, _callee, this, [[1, 15]]);\n    }));\n\n    return function getLuckyBagInfo() {\n      return _ref2.apply(this, arguments);\n    };\n  }();\n\n  // 渲染中奖列表\n  var renderGrabList = function () {\n    var _ref5 = _asyncToGenerator( /*#__PURE__*/__WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.mark(function _callee2(_ref4) {\n      var grabs = _ref4.grabs;\n      var ids, userList, grabHTML, grabTemplate, findUser, grabsMerge;\n      return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee2$(_context2) {\n        while (1) {\n          switch (_context2.prev = _context2.next) {\n            case 0:\n              grabsMerge = function grabsMerge(grabs, userList) {\n                return grabs.map(function (grab) {\n                  return _extends({}, grab, findUser(userList, grab.studentId));\n                });\n              };\n\n              findUser = function findUser(userList, id) {\n                return userList.find(function (user) {\n                  return user.id === id;\n                });\n              };\n\n              grabTemplate = function grabTemplate(grab) {\n                return '\\n        <div class=\"grab\">\\n          <img class=\"avatar\" src=\"' + grab.avatar + '\" onerror=\"this.src=\\'' + CDN_RESOURCE + '/mobile/campaign/luckyBag/img/avatar.png\\'\">\\n          <div class=\"nickname\">' + grab.nickname + '</div>\\n          <div class=\"created-at\">' + utils.format(new Date(grab.createdAt * 1000), 'yyyy.M.dd hh:mm') + '</div>\\n          <div class=\"amount ' + (grab.type === 1 ? '' : 'new') + '\">' + (grab.type === 1 ? grab.amount + '元奖学金' : '1课时') + '</div>\\n          <div class=\"amount-info\">' + (grab.type === 1 ? '奖学金可兑换课时' : '可立即预约1节<br/>北美外教在线课程4人班') + '</div>\\n        </div>\\n      ';\n              };\n\n              grabHTML = function grabHTML(grabs) {\n                return grabs.map(grabTemplate).join('');\n              };\n\n              _context2.prev = 4;\n\n              if (grabs && grabs.length > 0) {\n                _context2.next = 7;\n                break;\n              }\n\n              throw new Error('grabs为空');\n\n            case 7:\n              ids = grabs.map(function (grab) {\n                return grab.studentId;\n              });\n\n              if (ids && ids.length > 0) {\n                _context2.next = 10;\n                break;\n              }\n\n              throw new Error('ids为空');\n\n            case 10:\n              _context2.next = 12;\n              return fetchUserList(ids);\n\n            case 12:\n              userList = _context2.sent;\n\n              if (userList && userList.length > 0) {\n                _context2.next = 15;\n                break;\n              }\n\n              throw new Error('userList为空');\n\n            case 15:\n              grabs = grabsMerge(grabs, userList);\n              $('.grab-list').empty().append(grabHTML(grabs)).show();\n              console.log(grabs);\n              _context2.next = 23;\n              break;\n\n            case 20:\n              _context2.prev = 20;\n              _context2.t0 = _context2['catch'](4);\n\n              console.error(_context2.t0);\n\n            case 23:\n            case 'end':\n              return _context2.stop();\n          }\n        }\n      }, _callee2, this, [[4, 20]]);\n    }));\n\n    return function renderGrabList(_x) {\n      return _ref5.apply(this, arguments);\n    };\n  }();\n\n  // 显示隐藏弹窗\n\n\n  var campaign, av, STATUS_OK, STATUS_DONE, STATUS_GRABBED, STATUS_EXPIRED, account, code, resetGrabStatus, renderGrabStatus, showGrabSuccess, fetchUserList, fetchLuckyBagInfo, fetchGrabLuckyBag;\n  return __WEBPACK_IMPORTED_MODULE_0_babel_runtime_regenerator___default.a.wrap(function _callee3$(_context3) {\n    while (1) {\n      switch (_context3.prev = _context3.next) {\n        case 0:\n          fetchGrabLuckyBag = function fetchGrabLuckyBag() {\n            return account.$ajax({\n              type: 'PUT',\n              path: '/s/events/luckyBags/grab',\n              data: {\n                code: utils.utf8ToBase64(code)\n              }\n            });\n          };\n\n          fetchLuckyBagInfo = function fetchLuckyBagInfo(userInfo) {\n            return account.$ajax({\n              auth: userInfo ? true : false,\n              type: 'GET',\n              path: '/s/events/luckyBags' + (userInfo ? '' : '/public') + '?code=' + utils.utf8ToBase64(code)\n            });\n          };\n\n          fetchUserList = function fetchUserList(ids) {\n            return account.$ajax({\n              auth: false,\n              type: 'GET',\n              path: '/s/students/socials',\n              data: { ids: ids.join(',') }\n            }).catch(function (err) {\n              return [];\n            });\n          };\n\n          showGrabSuccess = function showGrabSuccess(status) {\n            if (status === 'show') {\n              $('.mask').attr('class', 'mask ' + status);\n              setTimeout(function () {\n                $('.grab-success').attr('class', 'grab-success ' + status);\n              }, 0);\n            } else {\n              $('.grab-success').attr('class', 'grab-success ' + status);\n              setTimeout(function () {\n                $('.mask').attr('class', 'mask ' + status);\n              }, 250);\n            }\n          };\n\n          renderGrabStatus = function renderGrabStatus(_ref3) {\n            var status = _ref3.status,\n                me = _ref3.me;\n\n            switch (status) {\n              // 未抢完\n              case STATUS_OK:\n                resetGrabStatus('.grab-ok');\n                break;\n              // 抢完了\n              case STATUS_DONE:\n                resetGrabStatus('.grab-done');\n                break;\n              // 已抢福袋\n              case STATUS_GRABBED:\n                if (me && me.type === 1) {\n                  // 老用户获得奖学金\n                  $('.grab-old .money').text(Number(me.amount).toFixed(1));\n                  resetGrabStatus('.grab-old');\n                  break;\n                } else if (me && me.type === 2) {\n                  // 新用户获得1课时\n                  resetGrabStatus('.grab-new');\n                  break;\n                }\n              // 福袋过期\n              case STATUS_EXPIRED:\n                resetGrabStatus('.grab-over');\n                break;\n              default:\n                resetGrabStatus('.grab-ok');\n                utils.toast('获取福袋状态失败');\n            }\n          };\n\n          resetGrabStatus = function resetGrabStatus(show) {\n            $('.grab-ok, .grab-done, .grab-timeout, .grab-class, .grab-old, .grab-new').hide();\n            show && $(show).show();\n          };\n\n          campaign = 'lucky-bag';\n          av = 'p011';\n          STATUS_OK = 1; // 福袋尚未抢完\n\n          STATUS_DONE = 2; // 福袋已被抢完\n\n          STATUS_GRABBED = 3; // 已抢福袋\n\n          STATUS_EXPIRED = 4; // 福袋过期\n\n          account = new Account();\n          code = utils.getUrlParam('gid');\n\n          if (!code) {\n            _context3.next = 24;\n            break;\n          }\n\n          utils.initAnalytics(av);\n          analytics.send({\n            event: av + '_open',\n            attr: {\n              _c: utils.getUrlParam('_c')\n            }\n          });\n          utils.initWechatShare({\n            title: '【久趣英语】一起抢福袋，瓜分千万奖学金！100%有奖！',\n            desc: '纯正北美外教，让4-12岁孩子，爱上英语！',\n            link: window.location.protocol + '//' + window.location.host + '/wx/lucky-bag?_c=' + campaign + '&gid=' + code,\n            imgUrl: 'https://static-app.97kid.com/site-student/public/mobile/campaign/luckyBag/icon/ic_share.jpg',\n            success: function success(target) {\n              analytics.send({\n                event: av + '-share',\n                attr: { target: target }\n              });\n            }\n          });\n          utils.supportPromise(account);\n          account.forceLogin = false; // 不强制登录\n          _context3.next = 22;\n          return getLuckyBagInfo();\n\n        case 22:\n          _context3.next = 25;\n          break;\n\n        case 24:\n          utils.goHome();\n\n        case 25:\n\n          $('.grab-btn').off('click').on('click', function (e) {\n            fetchGrabLuckyBag().then(getLuckyBagInfo).catch(grabError);\n\n            function grabError(err) {\n              console.error(err.message);\n              switch (err.code) {\n                case 'lucky.bag.grabbed.over':\n                  resetGrabStatus('.grab-done');\n                  break;\n                case 'student.lucky.bag.upper.limit':\n                  resetGrabStatus('.grab-timeout');\n                  break;\n                case 'lucky.bag.expired':\n                  resetGrabStatus('.grab-over');\n                  break;\n                default:\n                  resetGrabStatus('.grab-ok');\n                  utils.toast(err.message);\n              }\n            }\n          });\n\n          $('#grab-close').off('click').on('click', function (e) {\n            showGrabSuccess('hide');\n          });\n\n          $('.look-other').off('click').on('click', function (e) {\n            analytics.send({\n              event: av + '-look-other'\n            });\n            utils.goHome();\n          });\n\n          // 显示指定的状态页\n\n\n          // 渲染页面状态\n\n\n          // ===================接口函数==========================\n\n          // 用户信息列表接口\n\n\n          // 福袋信息接口\n\n\n          // 抢福袋接口\n\n        case 28:\n        case 'end':\n          return _context3.stop();\n      }\n    }\n  }, _callee3, _this);\n})));//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9wdWJsaWMvbW9iaWxlL2NhbXBhaWduL2x1Y2t5QmFnL2VzNi9sdWNreS1iYWcuanM/ZDY0NSJdLCJuYW1lcyI6WyJ1dGlscyIsInJlY292ZXJVcmxQYXJhbSIsIiQiLCJ1c2VySW5mbyIsImx1Y2t5QmFnSW5mbyIsImFjY291bnQiLCIkZ2V0VXNlckluZm8iLCJjb25zb2xlIiwibG9nIiwiZmV0Y2hMdWNreUJhZ0luZm8iLCJyZW5kZXJHcmFiU3RhdHVzIiwicmVuZGVyR3JhYkxpc3QiLCJlcnJvciIsImdldEx1Y2t5QmFnSW5mbyIsImdyYWJzIiwiZ3JhYkhUTUwiLCJncmFiVGVtcGxhdGUiLCJmaW5kVXNlciIsImdyYWJzTWVyZ2UiLCJ1c2VyTGlzdCIsIm1hcCIsImdyYWIiLCJzdHVkZW50SWQiLCJpZCIsImZpbmQiLCJ1c2VyIiwiYXZhdGFyIiwiQ0ROX1JFU09VUkNFIiwibmlja25hbWUiLCJmb3JtYXQiLCJEYXRlIiwiY3JlYXRlZEF0IiwidHlwZSIsImFtb3VudCIsImpvaW4iLCJsZW5ndGgiLCJFcnJvciIsImlkcyIsImZldGNoVXNlckxpc3QiLCJlbXB0eSIsImFwcGVuZCIsInNob3ciLCJyZXNldEdyYWJTdGF0dXMiLCJzaG93R3JhYlN1Y2Nlc3MiLCJmZXRjaEdyYWJMdWNreUJhZyIsIiRhamF4IiwicGF0aCIsImRhdGEiLCJjb2R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j5cbiAgICAgIGBcbiAgICB9XG5cbiAgICBmdW5jdGlvbiBmaW5kVXNlciAodXNlckxpc3QsIGlkKSB7XG4gICAgICByZXR1cm4gdXNlckxpc3QuZmluZCh1c2VyID0+IHVzZXIuaWQgPT09IGlkKVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGdyYWJzTWVyZ2UgKGdyYWJzLCB1c2VyTGlzdCkge1xuICAgICAgcmV0dXJuIGdyYWJzLm1hcChncmFiID0+ICh7Li4uZ3JhYiwgLi4uZmluZFVzZXIodXNlckxpc3QsIGdyYWIuc3R1ZGVudElkKX0pKVxuICAgIH1cbiAgfVxuXG4gIC8vIOaYvuekuumakOiXj+W8ueeql1xuICBmdW5jdGlvbiBzaG93R3JhYlN1Y2Nlc3MgKHN0YXR1cykge1xuICAgIGlmIChzdGF0dXMgPT09ICdzaG93Jykge1xuICAgICAgJCgnLm1hc2snKS5hdHRyKCdjbGFzcycsIGBtYXNrICR7c3RhdHVzfWApXG4gICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgJCgnLmdyYWItc3VjY2VzcycpLmF0dHIoJ2NsYXNzJywgYGdyYWItc3VjY2VzcyAke3N0YXR1c31gKVxuICAgICAgfSwgMClcbiAgICB9IGVsc2Uge1xuICAgICAgJCgnLmdyYWItc3VjY2VzcycpLmF0dHIoJ2NsYXNzJywgYGdyYWItc3VjY2VzcyAke3N0YXR1c31gKVxuICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICQoJy5tYXNrJykuYXR0cignY2xhc3MnLCBgbWFzayAke3N0YXR1c31gKVxuICAgICAgfSwgMjUwKVxuICAgIH1cblxuICB9XG5cbiAgLy8gPT09PT09PT09PT09PT09PT09PeaOpeWPo+WHveaVsD09PT09PT09PT09PT09PT09PT09PT09PT09XG5cbiAgLy8g55So5oi35L+h5oGv5YiX6KGo5o6l5Y+jXG4gIGZ1bmN0aW9uIGZldGNoVXNlckxpc3QgKGlkcykge1xuICAgIHJldHVybiBhY2NvdW50LiRhamF4KHtcbiAgICAgIGF1dGg6IGZhbHNlLFxuICAgICAgdHlwZTogJ0dFVCcsXG4gICAgICBwYXRoOiAnL3Mvc3R1ZGVudHMvc29jaWFscycsXG4gICAgICBkYXRhOiB7aWRzOiBpZHMuam9pbignLCcpfSxcbiAgICB9KS5jYXRjaChlcnIgPT4gKFtdKSlcbiAgfVxuXG4gIC8vIOemj+iii+S/oeaBr+aOpeWPo1xuICBmdW5jdGlvbiBmZXRjaEx1Y2t5QmFnSW5mbyAodXNlckluZm8pIHtcbiAgICByZXR1cm4gYWNjb3VudC4kYWpheCh7XG4gICAgICBhdXRoOiB1c2VySW5mbyA/IHRydWUgOiBmYWxzZSxcbiAgICAgIHR5cGU6ICdHRVQnLFxuICAgICAgcGF0aDogYC9zL2V2ZW50cy9sdWNreUJhZ3Mke3VzZXJJbmZvID8gJycgOiAnL3B1YmxpYyd9P2NvZGU9JHt1dGlscy51dGY4VG9CYXNlNjQoY29kZSl9YFxuICAgIH0pXG4gIH1cblxuICAvLyDmiqLnpo/ooovmjqXlj6NcbiAgZnVuY3Rpb24gZmV0Y2hHcmFiTHVja3lCYWcgKCkge1xuICAgIHJldHVybiBhY2NvdW50LiRhamF4KHtcbiAgICAgIHR5cGU6ICdQVVQnLFxuICAgICAgcGF0aDogYC9zL2V2ZW50cy9sdWNreUJhZ3MvZ3JhYmAsXG4gICAgICBkYXRhOiB7XG4gICAgICAgIGNvZGU6IHV0aWxzLnV0ZjhUb0Jhc2U2NChjb2RlKVxuICAgICAgfVxuICAgIH0pXG4gIH1cbn0pXG5cblxuLy8gV0VCUEFDSyBGT09URVIgLy9cbi8vIC4vcHVibGljL21vYmlsZS9jYW1wYWlnbi9sdWNreUJhZy9lczYvbHVja3ktYmFnLmpzIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///20\n");

    /***/
  },

  /***/3:
  /***/function _(module, exports) {

    eval("/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n!(function(global) {\n  \"use strict\";\n\n  var Op = Object.prototype;\n  var hasOwn = Op.hasOwnProperty;\n  var undefined; // More compressible than void 0.\n  var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n  var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n  var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n  var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n  var inModule = typeof module === \"object\";\n  var runtime = global.regeneratorRuntime;\n  if (runtime) {\n    if (inModule) {\n      // If regeneratorRuntime is defined globally and we're in a module,\n      // make the exports object identical to regeneratorRuntime.\n      module.exports = runtime;\n    }\n    // Don't bother evaluating the rest of this file if the runtime was\n    // already defined globally.\n    return;\n  }\n\n  // Define the runtime globally (as expected by generated code) as either\n  // module.exports (if we're in a module) or a new, empty object.\n  runtime = global.regeneratorRuntime = inModule ? module.exports : {};\n\n  function wrap(innerFn, outerFn, self, tryLocsList) {\n    // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n    var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n    var generator = Object.create(protoGenerator.prototype);\n    var context = new Context(tryLocsList || []);\n\n    // The ._invoke method unifies the implementations of the .next,\n    // .throw, and .return methods.\n    generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n    return generator;\n  }\n  runtime.wrap = wrap;\n\n  // Try/catch helper to minimize deoptimizations. Returns a completion\n  // record like context.tryEntries[i].completion. This interface could\n  // have been (and was previously) designed to take a closure to be\n  // invoked without arguments, but in all the cases we care about we\n  // already have an existing method we want to call, so there's no need\n  // to create a new function object. We can even get away with assuming\n  // the method takes exactly one argument, since that happens to be true\n  // in every case, so we don't have to touch the arguments object. The\n  // only additional allocation required is the completion record, which\n  // has a stable shape and so hopefully should be cheap to allocate.\n  function tryCatch(fn, obj, arg) {\n    try {\n      return { type: \"normal\", arg: fn.call(obj, arg) };\n    } catch (err) {\n      return { type: \"throw\", arg: err };\n    }\n  }\n\n  var GenStateSuspendedStart = \"suspendedStart\";\n  var GenStateSuspendedYield = \"suspendedYield\";\n  var GenStateExecuting = \"executing\";\n  var GenStateCompleted = \"completed\";\n\n  // Returning this object from the innerFn has the same effect as\n  // breaking out of the dispatch switch statement.\n  var ContinueSentinel = {};\n\n  // Dummy constructor functions that we use as the .constructor and\n  // .constructor.prototype properties for functions that return Generator\n  // objects. For full spec compliance, you may wish to configure your\n  // minifier not to mangle the names of these two functions.\n  function Generator() {}\n  function GeneratorFunction() {}\n  function GeneratorFunctionPrototype() {}\n\n  // This is a polyfill for %IteratorPrototype% for environments that\n  // don't natively support it.\n  var IteratorPrototype = {};\n  IteratorPrototype[iteratorSymbol] = function () {\n    return this;\n  };\n\n  var getProto = Object.getPrototypeOf;\n  var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n  if (NativeIteratorPrototype &&\n      NativeIteratorPrototype !== Op &&\n      hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n    // This environment has a native %IteratorPrototype%; use it instead\n    // of the polyfill.\n    IteratorPrototype = NativeIteratorPrototype;\n  }\n\n  var Gp = GeneratorFunctionPrototype.prototype =\n    Generator.prototype = Object.create(IteratorPrototype);\n  GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n  GeneratorFunctionPrototype.constructor = GeneratorFunction;\n  GeneratorFunctionPrototype[toStringTagSymbol] =\n    GeneratorFunction.displayName = \"GeneratorFunction\";\n\n  // Helper for defining the .next, .throw, and .return methods of the\n  // Iterator interface in terms of a single ._invoke method.\n  function defineIteratorMethods(prototype) {\n    [\"next\", \"throw\", \"return\"].forEach(function(method) {\n      prototype[method] = function(arg) {\n        return this._invoke(method, arg);\n      };\n    });\n  }\n\n  runtime.isGeneratorFunction = function(genFun) {\n    var ctor = typeof genFun === \"function\" && genFun.constructor;\n    return ctor\n      ? ctor === GeneratorFunction ||\n        // For the native GeneratorFunction constructor, the best we can\n        // do is to check its .name property.\n        (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n      : false;\n  };\n\n  runtime.mark = function(genFun) {\n    if (Object.setPrototypeOf) {\n      Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n    } else {\n      genFun.__proto__ = GeneratorFunctionPrototype;\n      if (!(toStringTagSymbol in genFun)) {\n        genFun[toStringTagSymbol] = \"GeneratorFunction\";\n      }\n    }\n    genFun.prototype = Object.create(Gp);\n    return genFun;\n  };\n\n  // Within the body of any async function, `await x` is transformed to\n  // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n  // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n  // meant to be awaited.\n  runtime.awrap = function(arg) {\n    return { __await: arg };\n  };\n\n  function AsyncIterator(generator) {\n    function invoke(method, arg, resolve, reject) {\n      var record = tryCatch(generator[method], generator, arg);\n      if (record.type === \"throw\") {\n        reject(record.arg);\n      } else {\n        var result = record.arg;\n        var value = result.value;\n        if (value &&\n            typeof value === \"object\" &&\n            hasOwn.call(value, \"__await\")) {\n          return Promise.resolve(value.__await).then(function(value) {\n            invoke(\"next\", value, resolve, reject);\n          }, function(err) {\n            invoke(\"throw\", err, resolve, reject);\n          });\n        }\n\n        return Promise.resolve(value).then(function(unwrapped) {\n          // When a yielded Promise is resolved, its final value becomes\n          // the .value of the Promise<{value,done}> result for the\n          // current iteration. If the Promise is rejected, however, the\n          // result for this iteration will be rejected with the same\n          // reason. Note that rejections of yielded Promises are not\n          // thrown back into the generator function, as is the case\n          // when an awaited Promise is rejected. This difference in\n          // behavior between yield and await is important, because it\n          // allows the consumer to decide what to do with the yielded\n          // rejection (swallow it and continue, manually .throw it back\n          // into the generator, abandon iteration, whatever). With\n          // await, by contrast, there is no opportunity to examine the\n          // rejection reason outside the generator function, so the\n          // only option is to throw it from the await expression, and\n          // let the generator function handle the exception.\n          result.value = unwrapped;\n          resolve(result);\n        }, reject);\n      }\n    }\n\n    var previousPromise;\n\n    function enqueue(method, arg) {\n      function callInvokeWithMethodAndArg() {\n        return new Promise(function(resolve, reject) {\n          invoke(method, arg, resolve, reject);\n        });\n      }\n\n      return previousPromise =\n        // If enqueue has been called before, then we want to wait until\n        // all previous Promises have been resolved before calling invoke,\n        // so that results are always delivered in the correct order. If\n        // enqueue has not been called before, then it is important to\n        // call invoke immediately, without waiting on a callback to fire,\n        // so that the async generator function has the opportunity to do\n        // any necessary setup in a predictable way. This predictability\n        // is why the Promise constructor synchronously invokes its\n        // executor callback, and why async functions synchronously\n        // execute code before the first await. Since we implement simple\n        // async functions in terms of async generators, it is especially\n        // important to get this right, even though it requires care.\n        previousPromise ? previousPromise.then(\n          callInvokeWithMethodAndArg,\n          // Avoid propagating failures to Promises returned by later\n          // invocations of the iterator.\n          callInvokeWithMethodAndArg\n        ) : callInvokeWithMethodAndArg();\n    }\n\n    // Define the unified helper method that is used to implement .next,\n    // .throw, and .return (see defineIteratorMethods).\n    this._invoke = enqueue;\n  }\n\n  defineIteratorMethods(AsyncIterator.prototype);\n  AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n    return this;\n  };\n  runtime.AsyncIterator = AsyncIterator;\n\n  // Note that simple async functions are implemented on top of\n  // AsyncIterator objects; they just return a Promise for the value of\n  // the final result produced by the iterator.\n  runtime.async = function(innerFn, outerFn, self, tryLocsList) {\n    var iter = new AsyncIterator(\n      wrap(innerFn, outerFn, self, tryLocsList)\n    );\n\n    return runtime.isGeneratorFunction(outerFn)\n      ? iter // If outerFn is a generator, return the full iterator.\n      : iter.next().then(function(result) {\n          return result.done ? result.value : iter.next();\n        });\n  };\n\n  function makeInvokeMethod(innerFn, self, context) {\n    var state = GenStateSuspendedStart;\n\n    return function invoke(method, arg) {\n      if (state === GenStateExecuting) {\n        throw new Error(\"Generator is already running\");\n      }\n\n      if (state === GenStateCompleted) {\n        if (method === \"throw\") {\n          throw arg;\n        }\n\n        // Be forgiving, per 25.3.3.3.3 of the spec:\n        // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n        return doneResult();\n      }\n\n      context.method = method;\n      context.arg = arg;\n\n      while (true) {\n        var delegate = context.delegate;\n        if (delegate) {\n          var delegateResult = maybeInvokeDelegate(delegate, context);\n          if (delegateResult) {\n            if (delegateResult === ContinueSentinel) continue;\n            return delegateResult;\n          }\n        }\n\n        if (context.method === \"next\") {\n          // Setting context._sent for legacy support of Babel's\n          // function.sent implementation.\n          context.sent = context._sent = context.arg;\n\n        } else if (context.method === \"throw\") {\n          if (state === GenStateSuspendedStart) {\n            state = GenStateCompleted;\n            throw context.arg;\n          }\n\n          context.dispatchException(context.arg);\n\n        } else if (context.method === \"return\") {\n          context.abrupt(\"return\", context.arg);\n        }\n\n        state = GenStateExecuting;\n\n        var record = tryCatch(innerFn, self, context);\n        if (record.type === \"normal\") {\n          // If an exception is thrown from innerFn, we leave state ===\n          // GenStateExecuting and loop back for another invocation.\n          state = context.done\n            ? GenStateCompleted\n            : GenStateSuspendedYield;\n\n          if (record.arg === ContinueSentinel) {\n            continue;\n          }\n\n          return {\n            value: record.arg,\n            done: context.done\n          };\n\n        } else if (record.type === \"throw\") {\n          state = GenStateCompleted;\n          // Dispatch the exception by looping back around to the\n          // context.dispatchException(context.arg) call above.\n          context.method = \"throw\";\n          context.arg = record.arg;\n        }\n      }\n    };\n  }\n\n  // Call delegate.iterator[context.method](context.arg) and handle the\n  // result, either by returning a { value, done } result from the\n  // delegate iterator, or by modifying context.method and context.arg,\n  // setting context.delegate to null, and returning the ContinueSentinel.\n  function maybeInvokeDelegate(delegate, context) {\n    var method = delegate.iterator[context.method];\n    if (method === undefined) {\n      // A .throw or .return when the delegate iterator has no .throw\n      // method always terminates the yield* loop.\n      context.delegate = null;\n\n      if (context.method === \"throw\") {\n        if (delegate.iterator.return) {\n          // If the delegate iterator has a return method, give it a\n          // chance to clean up.\n          context.method = \"return\";\n          context.arg = undefined;\n          maybeInvokeDelegate(delegate, context);\n\n          if (context.method === \"throw\") {\n            // If maybeInvokeDelegate(context) changed context.method from\n            // \"return\" to \"throw\", let that override the TypeError below.\n            return ContinueSentinel;\n          }\n        }\n\n        context.method = \"throw\";\n        context.arg = new TypeError(\n          \"The iterator does not provide a 'throw' method\");\n      }\n\n      return ContinueSentinel;\n    }\n\n    var record = tryCatch(method, delegate.iterator, context.arg);\n\n    if (record.type === \"throw\") {\n      context.method = \"throw\";\n      context.arg = record.arg;\n      context.delegate = null;\n      return ContinueSentinel;\n    }\n\n    var info = record.arg;\n\n    if (! info) {\n      context.method = \"throw\";\n      context.arg = new TypeError(\"iterator result is not an object\");\n      context.delegate = null;\n      return ContinueSentinel;\n    }\n\n    if (info.done) {\n      // Assign the result of the finished delegate to the temporary\n      // variable specified by delegate.resultName (see delegateYield).\n      context[delegate.resultName] = info.value;\n\n      // Resume execution at the desired location (see delegateYield).\n      context.next = delegate.nextLoc;\n\n      // If context.method was \"throw\" but the delegate handled the\n      // exception, let the outer generator proceed normally. If\n      // context.method was \"next\", forget context.arg since it has been\n      // \"consumed\" by the delegate iterator. If context.method was\n      // \"return\", allow the original .return call to continue in the\n      // outer generator.\n      if (context.method !== \"return\") {\n        context.method = \"next\";\n        context.arg = undefined;\n      }\n\n    } else {\n      // Re-yield the result returned by the delegate method.\n      return info;\n    }\n\n    // The delegate iterator is finished, so forget it and continue with\n    // the outer generator.\n    context.delegate = null;\n    return ContinueSentinel;\n  }\n\n  // Define Generator.prototype.{next,throw,return} in terms of the\n  // unified ._invoke helper method.\n  defineIteratorMethods(Gp);\n\n  Gp[toStringTagSymbol] = \"Generator\";\n\n  // A Generator should always return itself as the iterator object when the\n  // @@iterator function is called on it. Some browsers' implementations of the\n  // iterator prototype chain incorrectly implement this, causing the Generator\n  // object to not be returned from this call. This ensures that doesn't happen.\n  // See https://github.com/facebook/regenerator/issues/274 for more details.\n  Gp[iteratorSymbol] = function() {\n    return this;\n  };\n\n  Gp.toString = function() {\n    return \"[object Generator]\";\n  };\n\n  function pushTryEntry(locs) {\n    var entry = { tryLoc: locs[0] };\n\n    if (1 in locs) {\n      entry.catchLoc = locs[1];\n    }\n\n    if (2 in locs) {\n      entry.finallyLoc = locs[2];\n      entry.afterLoc = locs[3];\n    }\n\n    this.tryEntries.push(entry);\n  }\n\n  function resetTryEntry(entry) {\n    var record = entry.completion || {};\n    record.type = \"normal\";\n    delete record.arg;\n    entry.completion = record;\n  }\n\n  function Context(tryLocsList) {\n    // The root entry object (effectively a try statement without a catch\n    // or a finally block) gives us a place to store values thrown from\n    // locations where there is no enclosing try statement.\n    this.tryEntries = [{ tryLoc: \"root\" }];\n    tryLocsList.forEach(pushTryEntry, this);\n    this.reset(true);\n  }\n\n  runtime.keys = function(object) {\n    var keys = [];\n    for (var key in object) {\n      keys.push(key);\n    }\n    keys.reverse();\n\n    // Rather than returning an object with a next method, we keep\n    // things simple and return the next function itself.\n    return function next() {\n      while (keys.length) {\n        var key = keys.pop();\n        if (key in object) {\n          next.value = key;\n          next.done = false;\n          return next;\n        }\n      }\n\n      // To avoid creating an additional object, we just hang the .value\n      // and .done properties off the next function object itself. This\n      // also ensures that the minifier will not anonymize the function.\n      next.done = true;\n      return next;\n    };\n  };\n\n  function values(iterable) {\n    if (iterable) {\n      var iteratorMethod = iterable[iteratorSymbol];\n      if (iteratorMethod) {\n        return iteratorMethod.call(iterable);\n      }\n\n      if (typeof iterable.next === \"function\") {\n        return iterable;\n      }\n\n      if (!isNaN(iterable.length)) {\n        var i = -1, next = function next() {\n          while (++i < iterable.length) {\n            if (hasOwn.call(iterable, i)) {\n              next.value = iterable[i];\n              next.done = false;\n              return next;\n            }\n          }\n\n          next.value = undefined;\n          next.done = true;\n\n          return next;\n        };\n\n        return next.next = next;\n      }\n    }\n\n    // Return an iterator with no values.\n    return { next: doneResult };\n  }\n  runtime.values = values;\n\n  function doneResult() {\n    return { value: undefined, done: true };\n  }\n\n  Context.prototype = {\n    constructor: Context,\n\n    reset: function(skipTempReset) {\n      this.prev = 0;\n      this.next = 0;\n      // Resetting context._sent for legacy support of Babel's\n      // function.sent implementation.\n      this.sent = this._sent = undefined;\n      this.done = false;\n      this.delegate = null;\n\n      this.method = \"next\";\n      this.arg = undefined;\n\n      this.tryEntries.forEach(resetTryEntry);\n\n      if (!skipTempReset) {\n        for (var name in this) {\n          // Not sure about the optimal order of these conditions:\n          if (name.charAt(0) === \"t\" &&\n              hasOwn.call(this, name) &&\n              !isNaN(+name.slice(1))) {\n            this[name] = undefined;\n          }\n        }\n      }\n    },\n\n    stop: function() {\n      this.done = true;\n\n      var rootEntry = this.tryEntries[0];\n      var rootRecord = rootEntry.completion;\n      if (rootRecord.type === \"throw\") {\n        throw rootRecord.arg;\n      }\n\n      return this.rval;\n    },\n\n    dispatchException: function(exception) {\n      if (this.done) {\n        throw exception;\n      }\n\n      var context = this;\n      function handle(loc, caught) {\n        record.type = \"throw\";\n        record.arg = exception;\n        context.next = loc;\n\n        if (caught) {\n          // If the dispatched exception was caught by a catch block,\n          // then let that catch block handle the exception normally.\n          context.method = \"next\";\n          context.arg = undefined;\n        }\n\n        return !! caught;\n      }\n\n      for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n        var entry = this.tryEntries[i];\n        var record = entry.completion;\n\n        if (entry.tryLoc === \"root\") {\n          // Exception thrown outside of any try block that could handle\n          // it, so set the completion value of the entire function to\n          // throw the exception.\n          return handle(\"end\");\n        }\n\n        if (entry.tryLoc <= this.prev) {\n          var hasCatch = hasOwn.call(entry, \"catchLoc\");\n          var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n          if (hasCatch && hasFinally) {\n            if (this.prev < entry.catchLoc) {\n              return handle(entry.catchLoc, true);\n            } else if (this.prev < entry.finallyLoc) {\n              return handle(entry.finallyLoc);\n            }\n\n          } else if (hasCatch) {\n            if (this.prev < entry.catchLoc) {\n              return handle(entry.catchLoc, true);\n            }\n\n          } else if (hasFinally) {\n            if (this.prev < entry.finallyLoc) {\n              return handle(entry.finallyLoc);\n            }\n\n          } else {\n            throw new Error(\"try statement without catch or finally\");\n          }\n        }\n      }\n    },\n\n    abrupt: function(type, arg) {\n      for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n        var entry = this.tryEntries[i];\n        if (entry.tryLoc <= this.prev &&\n            hasOwn.call(entry, \"finallyLoc\") &&\n            this.prev < entry.finallyLoc) {\n          var finallyEntry = entry;\n          break;\n        }\n      }\n\n      if (finallyEntry &&\n          (type === \"break\" ||\n           type === \"continue\") &&\n          finallyEntry.tryLoc <= arg &&\n          arg <= finallyEntry.finallyLoc) {\n        // Ignore the finally entry if control is not jumping to a\n        // location outside the try/catch block.\n        finallyEntry = null;\n      }\n\n      var record = finallyEntry ? finallyEntry.completion : {};\n      record.type = type;\n      record.arg = arg;\n\n      if (finallyEntry) {\n        this.method = \"next\";\n        this.next = finallyEntry.finallyLoc;\n        return ContinueSentinel;\n      }\n\n      return this.complete(record);\n    },\n\n    complete: function(record, afterLoc) {\n      if (record.type === \"throw\") {\n        throw record.arg;\n      }\n\n      if (record.type === \"break\" ||\n          record.type === \"continue\") {\n        this.next = record.arg;\n      } else if (record.type === \"return\") {\n        this.rval = this.arg = record.arg;\n        this.method = \"return\";\n        this.next = \"end\";\n      } else if (record.type === \"normal\" && afterLoc) {\n        this.next = afterLoc;\n      }\n\n      return ContinueSentinel;\n    },\n\n    finish: function(finallyLoc) {\n      for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n        var entry = this.tryEntries[i];\n        if (entry.finallyLoc === finallyLoc) {\n          this.complete(entry.completion, entry.afterLoc);\n          resetTryEntry(entry);\n          return ContinueSentinel;\n        }\n      }\n    },\n\n    \"catch\": function(tryLoc) {\n      for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n        var entry = this.tryEntries[i];\n        if (entry.tryLoc === tryLoc) {\n          var record = entry.completion;\n          if (record.type === \"throw\") {\n            var thrown = record.arg;\n            resetTryEntry(entry);\n          }\n          return thrown;\n        }\n      }\n\n      // The context.catch method must only be called with a location\n      // argument that corresponds to a known catch block.\n      throw new Error(\"illegal catch attempt\");\n    },\n\n    delegateYield: function(iterable, resultName, nextLoc) {\n      this.delegate = {\n        iterator: values(iterable),\n        resultName: resultName,\n        nextLoc: nextLoc\n      };\n\n      if (this.method === \"next\") {\n        // Deliberately forget the last sent value so that we don't\n        // accidentally pass it on to the delegate.\n        this.arg = undefined;\n      }\n\n      return ContinueSentinel;\n    }\n  };\n})(\n  // In sloppy mode, unbound `this` refers to the global object, fallback to\n  // Function constructor if we're in global strict mode. That is sadly a form\n  // of indirect eval which violates Content Security Policy.\n  (function() { return this })() || Function(\"return this\")()\n);\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9ub2RlX21vZHVsZXMvcmVnZW5lcmF0b3ItcnVudGltZS9ydW50aW1lLmpzPzRhNTciXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBLGdCQUFnQjtBQUNoQjtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQSxjQUFjO0FBQ2QsS0FBSztBQUNMLGNBQWM7QUFDZDtBQUNBOztBQUVBO0FBQ0E7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7QUFFQTtBQUNBO0FBQ0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AgfVxuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGNvbnRleHQubWV0aG9kID09PSBcIm5leHRcIikge1xuICAgICAgICAgIC8vIFNldHRpbmcgY29udGV4dC5fc2VudCBmb3IgbGVnYWN5IHN1cHBvcnQgb2YgQmFiZWwnc1xuICAgICAgICAgIC8vIGZ1bmN0aW9uLnNlbnQgaW1wbGVtZW50YXRpb24uXG4gICAgICAgICAgY29udGV4dC5zZW50ID0gY29udGV4dC5fc2VudCA9IGNvbnRleHQuYXJnO1xuXG4gICAgICAgIH0gZWxzZSBpZiAoY29udGV4dC5tZXRob2QgPT09IFwidGhyb3dcIikge1xuICAgICAgICAgIGlmIChzdGF0ZSA9PT0gR2VuU3RhdGVTdXNwZW5kZWRTdGFydCkge1xuICAgICAgICAgICAgc3RhdGUgPSBHZW5TdGF0ZUNvbXBsZXRlZDtcbiAgICAgICAgICAgIHRocm93IGNvbnRleHQuYXJnO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGNvbnRleHQuZGlzcGF0Y2hFeGNlcHRpb24oY29udGV4dC5hcmcpO1xuXG4gICAgICAgIH0gZWxzZSBpZiAoY29udGV4dC5tZXRob2QgPT09IFwicmV0dXJuXCIpIHtcbiAgICAgICAgICBjb250ZXh0LmFicnVwdChcInJldHVyblwiLCBjb250ZXh0LmFyZyk7XG4gICAgICAgIH1cblxuICAgICAgICBzdGF0ZSA9IEdlblN0YXRlRXhlY3V0aW5nO1xuXG4gICAgICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChpbm5lckZuLCBzZWxmLCBjb250ZXh0KTtcbiAgICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcIm5vcm1hbFwiKSB7XG4gICAgICAgICAgLy8gSWYgYW4gZXhjZXB0aW9uIGlzIHRocm93biBmcm9tIGlubmVyRm4sIHdlIGxlYXZlIHN0YXRlID09PVxuICAgICAgICAgIC8vIEdlblN0YXRlRXhlY3V0aW5nIGFuZCBsb29wIGJhY2sgZm9yIGFub3RoZXI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V0aG9kIGZyb21cbiAgICAgICAgICAgIC8vIFwicmV0dXJuXCIgdG8gXCJ0aHJvd1wiLCBsZXQgdGhhdCBvdmVycmlkZSB0aGUgVHlwZUVycm9yIGJlbG93LlxuICAgICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICAgIGNvbnRleHQuYXJnID0gbmV3IFR5cGVFcnJvcihcbiAgICAgICAgICBcIlRoZSBpdGVyYXRvciBkb2VzIG5vdCBwcm92aWRlIGEgJ3Rocm93JyBtZXRob2RcIik7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciByZWNvcmQgPSB0cnlDYXRjaChtZXRob2QsIGRlbGVnYXRlLml0ZXJhdG9yLCBjb250ZXh0LmFyZyk7XG5cbiAgICBpZiAocmVjb3JkLnR5cGUgPT09IFwidGhyb3dcIikge1xuICAgICAgY29udGV4dC5tZXRob2QgPSBcInRocm93XCI7XG4gICAgICBjb250ZXh0LmFyZyA9IHJlY29yZC5hcmc7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIHZhciBpbmZvID0gcmVjb3JkLmFyZztcblxuICAgIGlmICghIGluZm8pIHtcbiAgICAgIGNvbnRleHQubWV0aG9kID0gXCJ0aHJvd1wiO1xuICAgICAgY29udGV4dC5hcmcgPSBuZXcgVHlwZUVycm9yKFwiaXRlcmF0b3IgcmVzdWx0IGlzIG5vdCBhbiBvYmplY3RcIik7XG4gICAgICBjb250ZXh0LmRlbGVnYXRlID0gbnVsbDtcbiAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgIH1cblxuICAgIGlmIChpbmZvLmRvbmUpIHtcbiAgICAgIC8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9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuY2F0Y2hMb2MsIHRydWUpO1xuICAgICAgICAgICAgfSBlbHNlIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0NhdGNoKSB7XG4gICAgICAgICAgICBpZiAodGhpcy5wcmV2IDwgZW50cnkuY2F0Y2hMb2MpIHtcbiAgICAgICAgICAgICAgcmV0dXJuIGhhbmRsZShlbnRyeS5jYXRjaExvYywgdHJ1ZSk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2UgaWYgKGhhc0ZpbmFsbHkpIHtcbiAgICAgICAgICAgIGlmICh0aGlzLnByZXYgPCBlbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgICAgICAgIHJldHVybiBoYW5kbGUoZW50cnkuZmluYWxseUxvYyk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhyb3cgbmV3IEVycm9yKFwidHJ5IHN0YXRlbWVudCB3aXRob3V0IGNhdGNoIG9yIGZpbmFsbHlcIik7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSxcblxuICAgIGFicnVwdDogZnVuY3Rpb24odHlwZSwgYXJnKSB7XG4gICAgICBmb3IgKHZhciBpID0gdGhpcy50cnlFbnRyaWVzLmxlbmd0aCAtIDE7IGkgPj0gMDsgLS1pKSB7XG4gICAgICAgIHZhciBlbnRyeSA9IHRoaXMudHJ5RW50cmllc1tpXTtcbiAgICAgICAgaWYgKGVudHJ5LnRyeUxvYyA8PSB0aGlzLnByZXYgJiZcbiAgICAgICAgICAgIGhhc093bi5jYWxsKGVudHJ5LCBcImZpbmFsbHlMb2NcIikgJiZcbiAgICAgICAgICAgIHRoaXMucHJldiA8IGVudHJ5LmZpbmFsbHlMb2MpIHtcbiAgICAgICAgICB2YXIgZmluYWxseUVudHJ5ID0gZW50cnk7XG4gICAgICAgICAgYnJlYWs7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgaWYgKGZpbmFsbHlFbnRyeSAmJlxuICAgICAgICAgICh0eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICAgdHlwZSA9PT0gXCJjb250aW51ZVwiKSAmJlxuICAgICAgICAgIGZpbmFsbHlFbnRyeS50cnlMb2MgPD0gYXJnICYmXG4gICAgICAgICAgYXJnIDw9IGZpbmFsbHlFbnRyeS5maW5hbGx5TG9jKSB7XG4gICAgICAgIC8vIElnbm9yZSB0aGUgZmluYWxseSBlbnRyeSBpZiBjb250cm9sIGlzIG5vdCBqdW1waW5nIHRvIGFcbiAgICAgICAgLy8gbG9jYXRpb24gb3V0c2lkZSB0aGUgdHJ5L2NhdGNoIGJsb2NrLlxuICAgICAgICBmaW5hbGx5RW50cnkgPSBudWxsO1xuICAgICAgfVxuXG4gICAgICB2YXIgcmVjb3JkID0gZmluYWxseUVudHJ5ID8gZmluYWxseUVudHJ5LmNvbXBsZXRpb24gOiB7fTtcbiAgICAgIHJlY29yZC50eXBlID0gdHlwZTtcbiAgICAgIHJlY29yZC5hcmcgPSBhcmc7XG5cbiAgICAgIGlmIChmaW5hbGx5RW50cnkpIHtcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcIm5leHRcIjtcbiAgICAgICAgdGhpcy5uZXh0ID0gZmluYWxseUVudHJ5LmZpbmFsbHlMb2M7XG4gICAgICAgIHJldHVybiBDb250aW51ZVNlbnRpbmVsO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gdGhpcy5jb21wbGV0ZShyZWNvcmQpO1xuICAgIH0sXG5cbiAgICBjb21wbGV0ZTogZnVuY3Rpb24ocmVjb3JkLCBhZnRlckxvYykge1xuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcInRocm93XCIpIHtcbiAgICAgICAgdGhyb3cgcmVjb3JkLmFyZztcbiAgICAgIH1cblxuICAgICAgaWYgKHJlY29yZC50eXBlID09PSBcImJyZWFrXCIgfHxcbiAgICAgICAgICByZWNvcmQudHlwZSA9PT0gXCJjb250aW51ZVwiKSB7XG4gICAgICAgIHRoaXMubmV4dCA9IHJlY29yZC5hcmc7XG4gICAgICB9IGVsc2UgaWYgKHJlY29yZC50eXBlID09PSBcInJldHVyblwiKSB7XG4gICAgICAgIHRoaXMucnZhbCA9IHRoaXMuYXJnID0gcmVjb3JkLmFyZztcbiAgICAgICAgdGhpcy5tZXRob2QgPSBcInJldHVyblwiO1xuICAgICAgICB0aGlzLm5leHQgPSBcImVuZFwiO1xuICAgICAgfSBlbHNlIGlmIChyZWNvcmQudHlwZSA9PT0gXCJub3JtYWxcIiAmJiBhZnRlckxvYykge1xuICAgICAgICB0aGlzLm5leHQgPSBhZnRlckxvYztcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgfSxcblxuICAgIGZpbmlzaDogZnVuY3Rpb24oZmluYWxseUxvYykge1xuICAgICAgZm9yICh2YXIgaSA9IHRoaXMudHJ5RW50cmllcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICB2YXIgZW50cnkgPSB0aGlzLnRyeUVudHJpZXNbaV07XG4gICAgICAgIGlmIChlbnRyeS5maW5hbGx5TG9jID09PSBmaW5hbGx5TG9jKSB7XG4gICAgICAgICAgdGhpcy5jb21wbGV0ZShlbnRyeS5jb21wbGV0aW9uLCBlbnRyeS5hZnRlckxvYyk7XG4gICAgICAgICAgcmVzZXRUcnlFbnRyeShlbnRyeSk7XG4gICAgICAgICAgcmV0dXJuIENvbnRpbnVlU2VudGluZWw7XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuXG4gICAgXCJjYXRjaFwiOiBmdW5jdGlvbih0cnlMb2MpIHtcbiAgICAgIGZv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